There's actually several issues here, one being the parsing issue
Henry has highlighted.

Another is a difficulty in reproducing the problem:

    f=: {{ GLOBAL=: 'global defined here' }}
   GLOBAL [ f''
|domain error in GLOBAL, executing monad GLOBAL
|       GLOBAL[f''
   GLOBAL [ f''
global defined here

We can make the problem more reproducible by explicitly erasing GLOBAL
before executing f.

   GLOBAL [ f erase'GLOBAL'
|domain error in GLOBAL, executing monad GLOBAL
|       GLOBAL[f erase'GLOBAL'

And, now that we have a viable test case, we can demonstrate workarounds:

   GLOBAL [[ f erase'GLOBAL'
global defined here
   GLOBAL [(f erase'GLOBAL')
global defined here

Generally speaking a parenthesized expression is always evaluated
before anything to the left of it is considered. But adding extra
verbs for the parser to chew on also works.

FYI,

-- 
Raul

On Sun, Dec 17, 2023 at 3:04 PM Henry Rich <henryhr...@gmail.com> wrote:
>
> This follows the parsing rules.
>
> f is executed when the pattern
>
> N V V N
>
> is seen on the execution stack. GLOBAL has already been stacked at that
> point, as an undefined verb. When later GLOBAL is to be executed, its value
> has been changed to a noun. That pun is disallowed.
>
> Henry Rich
>
> On Sun, Dec 17, 2023, 2:03 PM David Lambert <b49p23t...@gmail.com> wrote:
>
> > $ ijconsole
> >
> >      f=: {{ GLOBAL=: 'global defined here' }}
> >
> >      GLOBAL [ f''
> > |domain error in GLOBAL, executing monad GLOBAL
> > |       GLOBAL[f''
> >
> >      GLOBAL [ f''
> > global defined here
> >
> >      JVERSION
> > Engine: j9.5.0-beta9/j64avx2/linux
> > Build: commercial/2023-12-06T14:16:14/clang-11-0-0/SLEEF=1
> > Library: 9.5.5
> > Platform: Linux 64
> > Installer: unknown
> > InstallPath: /usr/share/j/9.5
> > Contact:www.jsoftware.com
> >
> > Be well,  Dave.
> >
> > ----------------------------------------------------------------------
> > 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

Reply via email to