/only refinement for save
[1/7] from: atruter:labyrinth:au at: 14-Aug-2003 11:36
I don't know if this has been raised before, but how does a /only
refinement (working the same as it does for mold) sound for save?
I often find I have to write:
write %file.dat mold/only blocks
where blocks contains zero or more blocks. This is due to the fact that
given:
b0: copy []
b1: copy [[1]]
b2: copy [[1][2]]
save %file.dat block-name will yield files containing:
[]
[[1]]
[1] [2]
respectively, where what we want is:
<0 byte file>
[1]
[1] [2]
Which allows load/all to address the blocks in a consistent manner.
Comments?
Regards,
Ashley
[2/7] from: andrew:martin:colenso:school at: 14-Aug-2003 14:14
That sounds like a good idea; I wish I had thought of it. Can you put it
into the feedback form at http://www.rebol.com/ please?
Andrew J Martin
Attendance Officer &
Information Systems Trouble Shooter
Colenso High School
Arnold Street, Napier.
Tel: 64-6-8310180 ext 826
Fax: 64-6-8336759
http://colenso.net/scripts/Wiki.r?AJM
http://www.colenso.school.nz/
[3/7] from: greggirwin::mindspring::com at: 13-Aug-2003 20:21
Hi Ashley,
AT> I don't know if this has been raised before, but how does a /only
AT> refinement (working the same as it does for mold) sound for save?
...
AT> Which allows load/all to address the blocks in a consistent manner.
AT> Comments?
What about using LOAD without the /ALL refinement? There are times
where I have to think about (and play with) various ways to store and
retrieve data to get what I want, so I'm not saying it's a bad idea.
If you call it /ONLY, then shouldn't the mirror be LOAD/ONLY? The
mirror of LOAD/ALL would be SAVE/ALL, and maybe that just needs a fix
or some detailed docs.
-- Gregg
[4/7] from: carl:rebol at: 13-Aug-2003 19:32
> I don't know if this has been raised before, but how does a /only
> refinement (working the same as it does for mold) sound for save?
We added that to the enhancement list a few years ago, but doing a
write file mold/only block
has been so easy, it's not been added to SAVE so far. However,
it does remain on the list for the reason you pointed out. Load
without /all does an odd thing with singular values.
(This was intentional to allow beginners to allow this case to work:
save %data 1234
value: load %data
)
-Carl
[5/7] from: atruter:labyrinth:au at: 14-Aug-2003 12:55
Hi Gregg
> What about using LOAD without the /ALL refinement? ...
You may want LOAD to treat [1] as a block as opposed to (LOAD/ALL) a block
within a block.
> If you call it /ONLY, then shouldn't the mirror be LOAD/ONLY? The
> mirror of LOAD/ALL would be SAVE/ALL, and maybe that just needs a fix
> or some detailed docs.
The /all refinement is already used by save and mold and relates to
serialized format. The /all refinement of load is the logical complement to
/only. I can see why it was named /all (as it is the opposite of /only in
some respects) but it is a different /all than used elsewhere (or in REBOL
parlance, it is used in a different context ;) ).
Regards,
Ashley
[6/7] from: g:santilli:tiscalinet:it at: 14-Aug-2003 14:33
Hi Ashley,
On Thursday, August 14, 2003, 3:36:54 AM, you wrote:
AT> Which allows load/all to address the blocks in a consistent manner.
AT> Comments?
If you use LOAD instead of LOAD/ALL you won't need /ONLY on SAVE.
Of course, this assumes that you're using a recent version of
REBOL that does not evaluate the header, or don't have any other
reason for wanting LOAD/ALL.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/
[7/7] from: greggirwin:mindspring at: 14-Aug-2003 8:50
Hi Ashley,
>> What about using LOAD without the /ALL refinement? ...
AT> You may want LOAD to treat [1] as a block as opposed to (LOAD/ALL) a block
AT> within a block.
I guess what I mean is that if you're saving and loading the data, you
know what you need to do based on how the data is formatted.
Ultimately, I'd like the same refinement to mean compatibility for
SAVE and LOAD.
-- Gregg