Henry Rich wrote:
>
> There is a request outstanding for a change to 0!:n, giving an optional
> left argument. The justification is to allow a verb to find the name of
> the script it was loaded in. I don't see why the current 4!:3 and 4!:4
> aren't adequate. Can someone explain why
>
> (4!:3'') {~ 4!:4 <'name_of_my_verb'
>
> doesn't suffice?
Well, Jasmin Pascal as the author should probably speak for his own
proposal and what he meant, but I understood the request as follows:
Currently, if you "load" a series of definitions not from a file
but a noun script, for example:
s =: 0 : 0
plus =: +
)
0!:101 s
plus =: +
17 plus 4
21
4!:4 <'plus'
_1
NB. not really meaningful in this case:
(4!:3'') {~ 4!:4 <'plus'
+------------------------------------------+
|/usr/local/j64-802/system/util/jadetag.ijs|
+------------------------------------------+
I take it the proposal is asking for a way to provide a pseudo filename
which could be specific for loading from a noun
'/some/arbitrary/string' 0!:101 s
which would be then used as the alledged script source. It also
assume that Jasmin was thinking of deriving a source noun from
a "not-quite-J-script" file. Imagine...
- a mail-file with a mail header and a J script body,
- a J script digitally signed by its author,
- a J script containing additional "WEB"-style documentation
- a J script containing extra code for instrumentation which
should be stripped off,
- a J script NOT containing instrumention code which should
be added.
In all these cases, the files could be preprocessed by some special
J loader code into noun scripts and "executed from noun" but, in case
of errors, with a helpful hint from which file the code originated.
Personally, I would prefer cpp-style #file/#line directives in
scripts. At any rate, the above is how I understood the proposal.
Martin
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm