After losing an argument years ago about the behavior induced by
"pass by name" to verbs in the case of mapped file variables, I have
made it a practice of carefully mapping files as read only (i.e. 1 -:
;3{RIGHTARG ) this works fine and seems to protect me from myself.
My question today is - why do the jmf routines require that I have
write access to a file even though I'm opening it as read only? Some
files I would like to look at in a map are not mine and while I have
group or world read access, I can't map them, even explicitly saying
read-only - unhappiness...
In playing with this and experimenting some, I would also like to
know if there is a way to shorten a mapped file. If I have a file
mapped (read-write) as x and write:
$x
3000
$x =. 100{. x
100
It looks OK, but the external file remains untouched. I assume this
is "intended behavior", but is there a rationale for it? Seems
confusing at best.
Further (starting over with the untouched file), if I do something like:
$x =. _100{. x
100
The file is indeed changed with the first 100 bytes being replaced by
the last 100 from the file (but the file is still 3000 bytes long).
Additionally, the "modified time" is not updated on the file - this
is also confusing.
I assume these things are "intended behavior", but is there a
rationale for it? Seems confusing at best.
- joey
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm