Opened 11 years ago

Closed 11 years ago

#391 closed bug (wontfix)

Problem with example part and map definition

Reported by: gorzel Owned by: hannes
Priority: major Milestone: 3-1-4 and higher
Component: singular-kernel Version: 3-1-3
Keywords: Cc:

Description

The procs goodproc, goodproc2, badproc do nothing else than to return the input polynomial after having called the identity map via

phi = basering,maxideal(1);

Suppose that there is ring defined with the same name as that defined in the example part. Then the problem occurs that, when calling the example part, Singular might access to the userdefined ring, but not to that of the example.

This, see proc badproc, has the following effect:

1.) Either example stops with an ERROR since outside there is no object

with that name as in the example, or

2.) it choose the object from the userdefined ring, in case an object

equally named as in the *argumentlist* of the proc exists.

The example part contains:

ring r = 0,(x,y),dp; poly h = 2x3y4 + x5+ y3;

and the argumentlist is (poly f).

> LIB "badlib3.lib";
// ** loaded badlib3.lib ($",?)
> basering;
   ? `basering` is undefined
   ? error occurred in or before STDIN line 2: `basering;`
> example badproc;
// proc badproc from lib badlib3.lib
EXAMPLE:

   ring r = 0,(x,y),dp;
   poly h = 2x3y4 + x5+ y3;
   badproc(h);
2x3y4+x5+y3

> ring r=0,(x,y,z),dp;
> example badproc;
// proc badproc from lib badlib3.lib
EXAMPLE:

   ring r = 0,(x,y),dp;
   poly h = 2x3y4 + x5+ y3;
   badproc(h);   
   ? f undefined in r
   ? error occurred in or before badlib3.lib::badproc line 35: `   g = phi(f);`
   ? leaving badlib3.lib::badproc
   skipping text from `;` error at token `)`
   ? leaving badlib3.lib::badproc

> poly f = x2+y3+z4;
> example badproc;
// proc badproc from lib badlib3.lib
EXAMPLE:

   ring r = 0,(x,y),dp;
   poly h = 2x3y4 + x5+ y3;
   badproc(h);
y3+x2

To avoid this side effect, see proc goodproc, one has to write explicitely

def d = basering;

before defining the map. However the 'd' itself has not to be used in the definition of the map. I.e.

map phi = basering,maxideal(1);

is enough, it is not necessary to write

map phi = d,maxideal(1);

Comment: The procs contains several uncommented listvar() calls

Attachments (3)

badlib3.lib (7.6 KB) - added by gorzel 11 years ago.
badlib3.in (698 bytes) - added by gorzel 11 years ago.
badlib3.out (1.7 KB) - added by gorzel 11 years ago.

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by gorzel

Attachment: badlib3.lib added

Changed 11 years ago by gorzel

Attachment: badlib3.in added

Changed 11 years ago by gorzel

Attachment: badlib3.out added

comment:1 Changed 11 years ago by hannes

Resolution: wontfix
Status: newclosed

This works as intended: all variables defined in an example are loca variables and cannot be used/found from another procedure. As mentioned: exceptions are ring, with are connected to local variables.

Note: See TracTickets for help on using tickets.