I didn't read your code, because of how it was formatted when I
received it. But that mostly probably means that I should have taken
responsibility to reformat it. Thus:

verbInClass_SomeClass_ =: plus
plus_SomeClass_ =: +
adv =: /

NB. then how about this ?

f =: 3 : 0
  s =. coname ''                    NB. save current locale
  C =. conew 'SomeClass'
  cocurrent > C
  v =. verbInClass f.
  cocurrent > s                     NB. restore current locale
  v adv y
)

But the real question should be: why would you want to do anything like this?

Conceptually speaking, locales should be used as "modules" where
administrative needs put different people on different tasks. The
class / object system then allows their work to be combined - perhaps
not efficiently, but reducing the name conflict issues to a relatively
manageable level. But that just justifies direct locale references.

The indirect locale reference thing doesn't have this justification.
The only places I have used it have been in the implementation of
specifications which were designed for other programming languages.
The resulting code tends to be extremely inefficient, but that tends
to not matter for those kinds of problems.

Which leads back to the question: why would you want to do this?

We need some practical use cases, I think, so that's really not a
rhetorical question, though I suppose it also might have some
rhetorical value...

For now, as other people have indicated, the resulting complexity
(from the language not internalizing support for this issue) seems
manageable in most cases, but it does require some detailed thought
and a careful understanding of the differences between names
(references) and values (an issue which tends to expose "painful"
differences across any pair of languages).

Or, that's my current opinion.

Thanks,

-- 
Raul


On Sun, Apr 23, 2017 at 1:37 PM, roger stokes <[email protected]> wrote:
>    NB. Suppose we have:
>
>
> verbInClass_SomeClass_ =: plus
>
> plus_SomeClass_ =: +
>
> adv =: /
>
>
> NB. then how about this ?
>
>
> f =: 3 : 0
>
> s =. coname ''                    NB. save current locale
>
> C =. conew 'SomeClass'
>
> cocurrent > C
>
> v =. verbInClass f.
>
> cocurrent > s                     NB. restore current locale
>
> v adv y
>
> )
>
>
> f 1 2 3
>
> 6
> ----------------------------------------------------------------------
> 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