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 19 years ago

Closed 19 years ago

Last modified 18 years ago

#331 closed enhancement (fixed)

convert objects without an explicit type

Reported by: imendez Owned by: Víctor de Buen Remiro
Priority: normal Milestone:
Component: Kernel Version: head
Severity: minor Keywords:
Cc: Alfredo Torre

Description

Hi.

Now, TOL looks for the "LastGrammar" when an object hasn't an explicit type:

Set s1 = 1, 2 ?;
Set s2 = "a", "b" ?;
Real a = 1;
BinGroup("+", s1);
BinGroup("<<", s2);

The last line yields an error because the Text type is not explicit and the
previous type is Real instead of Text. The same reason makes line #4 works
perfectly.

I propose an enhancement in order to look for the "DefaulGrammar" when no type
is explicitly defined. In this example, TOL Evaluator should cast the resulting
object to Text type, because we can know that it must be the returned type,
since "s2" elements are of this type.

Regards.

Change History (8)

comment:1 Changed 19 years ago by danirus

Status: newassigned

comment:2 Changed 19 years ago by Víctor de Buen Remiro

Owner: changed from danirus to Víctor de Buen Remiro
Status: assignednew

comment:3 Changed 19 years ago by Víctor de Buen Remiro

Resolution: fixed
Status: newclosed

Even I've fully agree with your proposal it's a feature incompatible with TOL
evaluator and syntax due to descending evaluation mode, incongruences like
objects overheading and others problems.

So it's imposible to implement this enhancement in TOL in any circumnstance. An
example code of incongruences allowed by TOL is next one:

Text a = "aa";
Text b = "bb";
Real a = 1;
Real b = 1;
Text result = If(a==b, "jeje", "jaja");

What should to compare a==b? Text variables "aa"=="bb" or Real ones 1==1?
Any of them are correct but result is different in each case because TOL syntax is
bad defined.

However an aproach in this sense has been made a few days ago and it's probable
that most of problems have been avoided. Else, please, send us more explicit
examples of code and expected or preferred behaviour.

comment:4 Changed 19 years ago by imendez

Now I have another problem. In the code:

Set s1 = 1, 2 ?;
Set s2 = "a", "b" ?;
Real a = 1;
BinGroup("+", s1);
BinGroup("<<", s2);

the only error qith past versions (e.g. 2004/09/20) message was with the last
line. But now the two last lines return an error message, so we go like the
crabs :-)

I can acept this behaviour, of course, but are you sure that is impossible to do
anything else?
In this case, I think it should be better to force us to specify the grammar in
the definition of any object. It's curious, because I use to try everytime to
specify always the grammar...

comment:5 Changed 19 years ago by Víctor de Buen Remiro

Sorry, I can't reproduce that behaviour. Both my local TOL and last-naight
versions only send an error and a secondary warning

ERROR: [1] BinGroup : << no es un operador de tipo Real

Warning: [1] La función BinGroup ha fallado en :
BinGroup("<<, s2)

It's possible you have another past failed version.

comment:6 Changed 19 years ago by imendez

Oops, you are right, I don´t know what I have done but I could have sworn that I
have seen two errors...

Sorry.

comment:7 Changed 18 years ago by Víctor de Buen Remiro

bug_file_loc: http://cvs.tol-project.org/viewcvs.cgi/tol_tests/tol/Bugzilla/bug_000331

comment:8 Changed 18 years ago by Víctor de Buen Remiro

blocked: 332
Note: See TracTickets for help on using tickets.