amitkumar3968 / ambienttalk

Automatically exported from code.google.com/p/ambienttalk
0 stars 0 forks source link

Context not refreshed during table definitions #29

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. def t[4] { def x := { nil } };

What is the expected output? What do you see instead?
Expected: a table with four (uninteresting) closures.
Result: an exception warning for the duplicate definition of x, when the 
closure is ran for the 
second time (i.e. t[1] with the above definition works properly). Consequently, 
the body of a table 
definition can currently not contain any definitions.

The closure is properly run in an activation call frame (i.e. after a t[1] x is 
not visible in the outer 
scope), yet it appears to be so that the same call frame is reused for 
subsequent values. 

Original issue reported on code.google.com by smost...@gmail.com on 14 Feb 2009 at 6:26

GoogleCodeExporter commented 9 years ago
It's very easy to fix this (I spotted the 2 lines in AGDefTable responsible for 
this behavior). However, the question 
is: do we want to fix it? The initialisation expression for table definitions 
was designed to be a side-effect-free 
expression. On the other hand, it does not really hurt to make a separate 
call-frame per evaluation of this 
expression. It causes less errors (like the one you mention above), but at the 
expense of performance (evaluation 
now requires only 1 call frame, as opposed to table.length call frames)

Original comment by tvcut...@gmail.com on 16 Feb 2009 at 9:19

GoogleCodeExporter commented 9 years ago
This feature is not very often... Do we still spend time on it? General 
consensus is to kick it out.

Original comment by Botje.linux@gmail.com on 24 May 2013 at 1:19

GoogleCodeExporter commented 9 years ago
This hasn't bitten me over the past few years. I think if we change it, it's 
harmless, so if someone wants to take on this bug go ahead. Otherwise let's 
just close it and move on.

Original comment by tvcut...@gmail.com on 24 May 2013 at 2:11