I guess I didn't understand the problem fully; however, (loc) will still give the wrong answer if the script had been previously loaded and another script since then.
On Nov 25, 2016 10:15 AM, "Henry Rich" <[email protected]> wrote: > I don't think this analysis is right. (y) has always been defined when an > explicit definition starts. The bug in 8.05 was that the script index was > not set. Otherwise everything is as it was. > > The only effect of the preallocated symbol table is that the names y and x > are assigned differently, for performance reasons. This led to the > omission of script index. > > Henry Rich > > On 11/25/2016 12:04 PM, Don Guinn wrote: > >> (loc) took advantage that before the latest optimization in 805 that (y) >> was undefined resulting in a return of _1 from (4!:4) . But now (y) is >> defined by the time (4!:4) is executed. But if one is relying on a _n from >> 4!:4, why not just do ({:>4!:3'') ? But that would only work if the script >> was being loaded for the first time. If the script were loaded earlier, >> then reloaded, it would not be the last filename in (4!:3) . >> >> It seems to me that a safer sequence to guarantee the filename of the >> script would be: >> >> MYLOC=:0 >> MYLOC=:(4!:4<'MYLOC'){4!:3'' >> >> This will work even if the script has been loaded previously. >> >> On Fri, Nov 25, 2016 at 9:29 AM, Henry Rich <[email protected]> wrote: >> >> Yes, it's stored in the symbol table, but it's set when the value is >>> assigned - except for y[/x]. >>> >>> Henry rich >>> >>> On 11/25/2016 10:19 AM, Raul Miller wrote: >>> >>> Isn't the 4!:4 value stored in the symbol table? (I have not yet >>>> studied the code, I am just trying to think things through.) >>>> >>>> If so, shouldn't the 4!:4 value for y get set when the symbol table is >>>> created (at verb definition time)? Or, at least, I cannot think of any >>>> reason why it should get changed after that... >>>> >>>> If not, ... I guess I should go read the code if it's not stored there. >>>> >>>> Thanks, >>>> >>>> >>>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >>> >>> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
