Ian Clark wrote:
IC>     Another thing I'd really like in J (and rookies shouldn't be allowed
IC>     to ask such things) is something like the C++ "const". A way of
IC>     locking down the name of a quantity so that it can't be changed during
IC>     "the run", whatever that is -- at least not without raising an error.

Newbie!  Such a thing actually exists in the early (open source)
J versions, called "given names".  These were identifiers ending
in a colon:

% j7
J7 Copyright (c) 1990-1993, Iverson Software Inc.  All Rights Reserved.

   foo: =. 8
   foo:
8
   foo: =. 9
|not reassignable
|   foo:  =.9
   foo:
8
   0!:55 ]0
%

The very early versions wouldn't even let you erase a given name.
The first actual implementation of given names was in J version 3
(March 1991);  Since version 5, you were allowed to erase a given
name (and re-introduce it with a new value).

Back at the time, all "lettered" primitives ended in a dot.
J Release 2 (the first commercial, non-source release) introduced the
first "letter-colon" primitives (a: D: L: p: q: t:, to be specific)
and dropped user-defined "given names" at the same time.

I don't know why given names were removed from the language.
Version 7 was the one which introduced locales and name_loc_
locatives, and things like "foo:_loc_" or "foo_loc_:" weren't
implemented at all or not as you would have expected.  Perhaps there
was just too much ambiguity about "the end of a name" and the
facility too unused to keep bothering about it any further.
I really don't know.

                                                        Martin
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to