The problem here is transitive (thinking about the call stack and the relationship between the represented partial execution contexts).
We want things to operate correctly but, when multiple locales are involved, correctness at the interface is different from internal correctness. This winds up being both a documentation issue and an implementation issue (with trade offs pushing complexity into one or the other). -- Raul On Thu, May 12, 2022 at 3:57 PM Henry Rich <henryhr...@gmail.com> wrote: > > I think I agree with you, but I have been reluctant to suggest the > change. I am not sure what the ramifications of the change would be. > > Henry Rich > > On 5/12/2022 3:27 PM, Jan-Pieter Jacobs wrote: > > I agree with you on locales causing troubles. Especially since some things > > just seem to go against the grain of J, i.e. don't work as expected. > > > > For instance today, I tried writing an explicit adverb that would need to > > execute in an object's locale. It didn't work, because once a verb is > > derived, it looses track of the locale the adverb was defined in. At least > > it was well documented in the wiki ( > > https://code.jsoftware.com/wiki/Vocabulary/Locales#Adverbs_in_Locales), so > > instead of writing: > > > > myadv =: 1 : 0 > > NB. stuff > > ) > > > > I had to write: > > myadv =: 1 : 0 > > u myadv_impl (coname'') > > ) > > myadv_impl =: 2 : 0 > > return_locale=. coname'' > > cocurrent n > > NB. stuff setting return_value as local var > > cocurrent return_locale > > return_value > > ) > > > > This works, but honestly, it's ugly. > > I imagine having to create a similar conjunction is even more ugly, having > > to somehow pass the locale boxed together with one of the arguments of the > > conjunction... > > I wonder whether there's a use case where one would actually want a > > modifier to forget the locale it was defined in (as it is now). > > > > Jan-Pieter > > > > On Thu, 12 May 2022, 19:05 Raul Miller, <rauldmil...@gmail.com> wrote: > > > >> After further thought (though perhaps still not enough time studying > >> the code and thinking about its use), a better approach (than > >> coinsert'base', which would allow name collisions) would be to use > >> > >> do_base_ > >> > >> instead of > >> > >> ". > >> > >> where that is used (getDEoptim and packargs). > >> > >> Sadly, there's no equivalent workaround for ~ > >> > >> That said, we could define a verb to specify a default locale: > >> > >> inlocale=: (],'_','_',~[)^:(0='_'-:{:@])L:0~ > >> > >> 'f' inlocale 'base' > >> f_base_ > >> 'f_foo_' inlocale 'base' > >> f_foo_ > >> (<'f') inlocale 'base' > >> +-------+ > >> |f_base_| > >> +-------+ > >> > >> And then deoptim could be updated with > >> func=. func inlocale'base' > >> > >> This would require that historical usage of deoptim (which defined > >> functions in pdeoptim) would have to be changed, but it would make > >> casual use easier. > >> > >> I'm not sure this is needed in this example (is there any casual use > >> of deoptim?), but this issue (documenting and handling locale issues) > >> is one I think about way too often. > >> > >> > >> -- > >> Raul > >> > >> On Wed, May 11, 2022 at 11:00 PM Ric Sherlock <tikk...@gmail.com> wrote: > >>> Hi David, > >>> Thanks for the feedback. I agree that adding some additional text there > >> may > >>> help users trying to work out how to use the addon. Did you have a > >>> suggested wording change in mind? > >>> > >>> The function named will be called from within the 'pdeoptim' locale and > >> so > >>> needs to either be in the search path of pdeoptim or called from its > >>> explicit location (which may or may not be in 'base'). > >>> > >>> The examples in the test folder all append the locale of the desired > >>> function to the name to ensure that it is found. There may be a better > >>> solution, but when I wrote the addon that was what I came up with! > >>> > >>> Thanks, > >>> > >>> > >>> > >>> > >>> > >>> On Thu, May 12, 2022 at 2:35 AM David Lambert <b49p23t...@gmail.com> > >> wrote: > >>>> Suggestion: please amend the comment section to explicitly state that > >>>> func include locale. It now reads > >>>> > >>>> NB.-y: 2-item list of boxed arguments > >>>> NB.- 0{ func - String naming a function f(x,y) to minimize, with > >>>> first argument > >>>> NB.- the vector of variables over which minimization is to > >>>> take place. > >>>> NB.- It should return a scalar result. Empty values are not > >>>> allowed. > >>>> > >>>> Thank you, David Lambert > >>>> > >>>> ---------------------------------------------------------------------- > >>>> 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 > > > -- > This email has been checked for viruses by AVG. > https://www.avg.com > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm