>  This implies that this mechanism is limited to the kinds of things that
>  can be represented using mapped files.

The statement is true, but not for the reasons you imply (or that I infer
you imply).

The read-only mechanism works by setting a flag in the name's header.  All
J headers share the same format [1].  Therefore any J name of any class
can theoretically be marked as read-only (i.e. not just mapped nouns, nor
just nouns).

For an example, here's an excerpt from a J601 session:

           plus=:+
           15!:6{.;:'plus'
        22098584
           
           require 'jmf'
           1 readonly_jmf_ 'plus'
           
           plus =: -
        |read-only data
        |   plus    =:-
           
Note that this has nothing to do with mapped files;  readonly_jmf_  is just
a utility to set that flag in a name's header.  This works by getting a
refernce to the name (using  15!:6  ), reading in the flags field of the
underlying structure, changing the readonly flag, and writing the field
back.

You'll notice two things: one, I said "theoretically"; two, the excerpt
from is J601.  That's because J602 introduced a frustrating change.  It is
no longer possible to get a reference to a non-noun name using   15!:6  . 
Concretely, the difference is:

           9!:14 '' NB.  J601
        j601/2006-11-17/17:05
           
           aNoun =: 'noun'
           aVerb =: +/ % #
           
           15!:6 <'aNoun'
        22098656
           
           15!:6 <'aVerb'
        22098632
           
versus:
           
           9!:14 '' NB.  J602
        j602/2008-03-03/16:45
              
           aNoun =: 'noun'
           aVerb =: +/ % #
              
           15!:6 <'aNoun'
        26038640
              
           15!:6 <'aVerb'
        |domain error
        |       15!:6<'aVerb'
        |[-7] 
           

Though J602 is fairly new, this change has already thwarted me on several
occasions, and I wish it would be rolled back.  What was its rationale? 

-Dan

[1]  http://www.jsoftware.com/jwiki/Essays/Incunabulum
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to