close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 20 years ago

Closed 20 years ago

#247 closed enhancement (fixed)

MakeGlobal allows only left-evaluable expressions

Reported by: imendez Owned by: danirus
Priority: normal Milestone:
Component: Kernel Version: 1.1.2
Severity: minor Keywords:
Cc:

Description

In this code:

Set s =
{

Real n =1;
Text name = "c"+ FormatReal(n, "%.0lf");
Set c = n/2, n*2 ?;
Set Eval("Set "+ name +" = n, n*2 ?;");
Set MakeGlobal(Eval("Set "+ name +" = n, n*2 ?;"+ name +";"));
Set MakeGlobal(c);
Eval(name)

};
Set a = c1;
Set b = c;

TOL return these error messages:

Warning: La función MakeGlobal ha fallado en :
MakeGlobal(Eval("Set "+name+" = n, n*2 ?;"+name+";"))
ERROR: c1 no es un objeto de tipo Set.
ERROR: a no se pudo crear.

and I think it's because MakeGlobal doesn't allow an evaluated object, since "b" is
created without problems as an image of "c".

Regards.

Change History (3)

comment:1 Changed 20 years ago by danirus

Severity: normalenhancement
Summary: MakeGlobal doesn't allow an evaluated objectMakeGlobal allows only left-evaluable expressions

Hi Iván,

The problem is not the Eval function, as we can suspect. The expressions we can
use as argument for MakeGlobal must be Left-Evaluable expressions, like variable
declarations. For that reason, any assignment expression then is not allowed.
I think this behavior can be improved (I've felt free to change this Bug
Severity to "Enhancement").

Thanks for your report.
Kind regards,

Daniel

comment:2 Changed 20 years ago by danirus

Status: newassigned

comment:3 Changed 20 years ago by danirus

Resolution: fixed
Status: assignedclosed

I just applied a change to MakeGlobal in order to allow the use of normal
expressions as arguments. Those that are using MakeGlobal extensively, please
report me any bad impression that could appear after this commit.

Kind regards
Daniel

Note: See TracTickets for help on using tickets.