Currently, J does not nest scopes (nor locales). This is conceptually simpler than Lua's approach, but perhaps frustrating for people who have been trained to expect such things.
FYI, -- Raul On Fri, Apr 7, 2017 at 4:06 PM, Jan-Pieter Jacobs <janpieter.jac...@gmail.com> wrote: > Maybe this goes too far from the original idea, but I always liked the tiny > Lua language for it's very clear scoping rules: > > if it's local, it's local to where the variable (can be a function) was > defined, and visible for any function defined while in that scope. Even if > control goes out of that scope, a function has always access to the locals > in the scope it was defined (called upvalues). Maybe something similar > could apply to all verbs, adverbs and conjunctions too? > > Furthermore, all modules are basically simply tables (the one and only > compound data type in Lua), and as such, they can be nested at will. > > On top of that, metatables allow for defining any fall-through cases if a > key is not found in a table... > > Anyhow, just to say, maybe there's some inspiration to be gotten in the Lua > Reference manual: https://www.lua.org/manual/5.3/manual.html#3.5 > > I've had the plan to interface Lua or its JIT brother LuaJIT.org with J > (their C interface is not too complicated), to have an alternative to the > relatively clunky feeling of explicit J. Up to now, I haven't found the > time to do so, though… > > Best regards, > > Jan-Pieter > > On 7 Apr 2017 19:20, "'Pascal Jasmin' via Programming" < > programm...@jsoftware.com> wrote: > >> To clarify the nested locale problem, >> >> if a is an instanced (numbered locale) object within the 'far' locale, and >> has member b, you canoot do >> >> b__a_far_. >> >> The workaround that I have used is to modify coclass such that it creates >> a member in the 'OOP' locale. >> >> >> far_OOP- =: <'far' >> >> so now you can access nested as, >> >> b__a__far__OOP >> >> The first syntax would be preferable. I don't see much of a need for >> non-instanced locales within other locales. ie, a far (non instanced non >> numbered) locale within base locale >> >> >> a_far_base_ NB. not really needed. >> ________________________________ >> From: bill lam <bbill....@gmail.com> >> To: programm...@jsoftware.com >> Sent: Friday, April 7, 2017 11:51 AM >> Subject: Re: [Jprogramming] locales with adverbs and conjunctions? >> >> >> nest locale is interesting. I think J can implement it by >> changing parser/tokenizer to recognize name_a$b$c_ as name in >> locale c within locale b which is inside locale a. >> a is in copath of a$b which is in copath of a$b$c. >> >> Пт, 07 апр 2017, Raul Miller написал(а): >> > If we *do* change that, then perhaps we should also be thinking about >> > being able to nest locales (much like K's namespaces), also. >> > >> > The current flat arrangement is based on this rationale which we are >> > now questioning. >> > >> > Put differently: we should not simply change how things work without >> > thinking through the implications of that change. >> > >> > (We will also need a way of determining the locale of an anonymous >> > verb, for example. Also: would it be possible to have a locale-free >> > verb? If not, what are the implications of that?) >> > >> > Thanks, >> > >> > -- >> > Raul >> > >> > >> > On Thu, Apr 6, 2017 at 5:02 PM, Henry Rich <henryhr...@gmail.com> wrote: >> > > Currently, yes. But the question is whether we should change that. >> > > >> > > Henry Rich >> > > >> > > On 4/6/2017 4:41 PM, Raul Miller wrote: >> > >> >> > >> Anonymous verbs do not *have* a locale. Locale is an aspect of names >> > >> and how things are named. >> > >> >> > > >> > > ---------------------------------------------------------------------- >> > > For information about J forums see http://www.jsoftware.com/forums.htm >> > ---------------------------------------------------------------------- >> > For information about J forums see http://www.jsoftware.com/forums.htm >> >> -- >> regards, >> ==================================================== >> GPG key 1024D/4434BAB3 2008-08-24 >> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3 >> gpg --keyserver subkeys.pgp.net --armor --export 4434BAB3 >> >> ---------------------------------------------------------------------- >> 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