#409 closed defect (invalid)
Annoying: PutMatDat does not work inside For...
Reported by: | jimarin | Owned by: | danirus |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Various | Version: | head |
Severity: | major | Keywords: | TOL |
Cc: |
Description
Estimated colleagues,
the recipe to reproduce this (most annoying) bug:
Create a file whose content is:
Matrix GlMat = Col(1,2,3,4,5,6);
Set For(1, 6, Real(Real ThN){
Real PutMatDat(GlMat, ThN, 1, 6-ThN+1)
});
Tell tol to compile the file. The matrix is untouched.
The funny thing is that if you do put the given lines into the eval console tol
does it.
I would say that reassigning matrix elements inside loops is something that
could be very useful to most analyst, that is the reason I marked this bug as
being major.
Thanks in advance for being there.
jima
Change History (10)
comment:1 Changed 19 years ago by
Component: | ENGINE_Evaluator → Unclassified |
---|---|
Keywords: | Tol-Base added; TOL removed |
Owner: | changed from danirus to rcsoto |
product: | TOL → Tol-Base |
comment:2 Changed 19 years ago by
Ok, I wait for the tolbase team to keep me updated then.
Thanks !
jima
comment:3 Changed 19 years ago by
Keywords: | TOL added; Tol-Base removed |
---|---|
product: | Tol-Base → TOL |
comment:4 Changed 19 years ago by
Hmmm, perhaps I forgot... my tol version dates from 20th of February of 2006.
This might be of importance I guess.
Thanks.
jima
comment:5 Changed 19 years ago by
Owner: | changed from rcsoto to danirus |
---|
comment:6 Changed 19 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
Hi Jima,
Part of the behavior you have shown here can not be considered a Bug, due to the
Lazy property of Tol.
Bye
comment:7 Changed 19 years ago by
Ok, but...then...
what should I do to force Tol to work and forget its lazy mood for a while?
jima
comment:8 Changed 19 years ago by
Hi Jima, you can write something like this:
Matrix GlMat = Col(1,2,3,4,5,6);
Set For(1, 6, Real(Real ThN){
Real Do(PutMatDat(GlMat, ThN, 1, 6-ThN+1))
});
note the use of "Do" forcing the evaluation of PutMatDat
Also the Real objects in TOL are not Lazy, so if a Real object has name then it
is evaluated when created.
In the initial code each result of the For is a Real object without name. If
you write the code this other way:
Matrix GlMat = Col(1,2,3,4,5,6);
Set For(1, 6, Real(Real ThN){
Real res = PutMatDat(GlMat, ThN, 1, 6-ThN+1)
});
you will fore also the evaluation of the Real objects.
If, with the initial code, you inspect the result of the Set then each PutMatDat
is executed and as a result the object GlMat is changed, but this an effect I
don't like.
best regards,
Jorge
comment:10 Changed 18 years ago by
bug_file_loc: | → http://cvs.tol-project.org/viewcvs.cgi/tol_tests/tol/Bugzilla/bug_000409 |
---|
Hi Jima, I've checked it and it's a Tolbase bug.
You can also check it with Tol Console (based on ncurses).
Cheers.