r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Ladislav
14-Jul-2010
[17315]
you we not
: "we do not"
Maxim
14-Jul-2010
[17316]
in R3, there is save/all which stores in serialized format, which 
might solve that particular case (saving a whole script)
Ladislav
14-Jul-2010
[17317]
{I agree with Ladislav, though, that serialization should be addressed 
more "completely" at some point, directly within the language.} - 
I do not need that, especially not in this case; but I do want to 
help people to not get caught by the bad design decision making SAVE 
inadequate for the task it is supposed to perform.
Maxim
14-Jul-2010
[17318]
actually it seems even R2 has /ALL refinement.
Ladislav
14-Jul-2010
[17319x2]
Yes, that is not a problem, problem is, that almost everyone would 
expect SAVE to be adequate.
Ceterum censeo Carthaginem esse delendam

 - the SAVE function (especially in R3) should work as SAVE/ALL does, 
 while the "gotcha functionality" should be discarded.
Maxim
14-Jul-2010
[17321]
but SAVE/ALL will distort the output such that many values such as 
true and none  will be written in their serialized (and ugly) format 
of #[true] and #[none]  so that is not optimal either.
Ladislav
14-Jul-2010
[17322x2]
Are you kidding? Try to load any script and save it
if you use SAVE/ALL you obtain the code, that is as close to original 
as possible
Andreas
14-Jul-2010
[17324]
Maxim:
>> mold/all load "foo: none"
== "[foo: none^/]"
no distortion here
Ladislav
14-Jul-2010
[17325]
...and, being at it, what does that "ugly" mean?
Maxim
14-Jul-2010
[17326]
aahhh yes... loading doesn't convert the word tokens to their values, 
so they do not get converted to #[none]... they are still words... 


though all the comments disapear... which is understandable in this 
case.
Ladislav
14-Jul-2010
[17327x3]
serialized

 is an inadequate notion as well, would you call "0.10000000000000001" 
 "serialized"?
#[true]

 is a normal REBOL syntax, since REBOL is a language, and LOAD as 
 well as Lad recognize it.
:-p
Maxim
14-Jul-2010
[17330x2]
yes, but its the "mechanical" syntax which is meant for the interpreter, 
not humans... Part of the reason I use REBOL is that I don't have 
to use machine syntax.
if you had a pre-processor which converted all none to #[none]... 
first thing I'd do is stop using your tool   ;-p
Ladislav
14-Jul-2010
[17332]
mechanical

? - it is the only syntax allowing me to write a logic! type value 
in using the Data exchange dialect. There is no other way how to 
do it.
Andreas
14-Jul-2010
[17333]
#[none] is the only literal representation of the corresponding abstract 
object
Ladislav
14-Jul-2010
[17334x4]
Why the "converted none to #[none]" - that is exactly what *I* am 
against
In the DED (Data exchange dialect) none is a word, nobody wants to 
transform it to a value of a different type, and it actually never 
happens
...as Andreas demonstrated above, so why to pull out that strawman?
Generallly, "preprocessing REBOL scripts" means to work with the 
DED, not with the DD (Do dialect)
Maxim
14-Jul-2010
[17338x2]
but one must understand that when you LOAD data, no evaluation occurs, 
which is why serialization into litterals does not occur. 

this is a big detail, which most REBOLers do not grasp.


the litteral notation allows you to load items AS data, not as DO 
dialect source code.


I guess what could be done is to remove the /ALL refinement and add 
a new refinement which forces the non /serialized format.  but that 
makes SAVE work opposite of other serialization handling ... which 
is why I'm not sure that is such a good thing.
for data exchange, I really think that a deeper serialization is 
required.   even MOLD/ALL is inadequate for any serious project. 
 I've been bitten many times.  things like recursive object molding 
or breaking can occur.  ex:

>> a: context [b: none]
>> b: context [a: none]
>> b/a: a
>> a/b: b
>> mold/all a
{#[object! [
    b: #[object! [
        a: #[object! [...]
    ]]
]]}
Ladislav
14-Jul-2010
[17340]
but one must understand that when you LOAD data, no evaluation occurs, 
which is why serialization into litterals does not occur.
 - this looks like a confused statement to me. Example:

mold/all load "true" ; == "true"
mold/all load "#[true]"; == "#[true]"

There is no rocket science involved.
Maxim
14-Jul-2010
[17341x2]
in your first line... the loaded value is a word, not a #[true] value... 
but people don't get this.
it becomes obvious to advanced users, cause we've had to go deep 
into the bindology, but casual/intermediate REBOLers se all the datatype/binding/loading 
stuff as magic.
Ladislav
14-Jul-2010
[17343x2]
They should read http://en.wikipedia.org/wiki/REBOL#Syntax
This has nothing to do with any bindology, no rocket science involved
Andreas
14-Jul-2010
[17345]
even more of a reason why non-/all save needs to be abolished
Ladislav
14-Jul-2010
[17346]
exactly!
Maxim
14-Jul-2010
[17347]
I don't agree, SAVE & SAVE/ALL have different uses.
Ladislav
14-Jul-2010
[17348]
They do? Then, would you be so kind, and explain to me what is the 
purpose of SAVE? (I never found any)
Andreas
14-Jul-2010
[17349]
so what use do you have for non-/all save?
Maxim
14-Jul-2010
[17350]
well, the same for mold & mold/all


by all accounts, we should also abolish non-/ALL mold then, cause 
they are symmetric.
Andreas
14-Jul-2010
[17351]
(ok, i'll abstain. ladislav is faster :)
Ladislav
14-Jul-2010
[17352]
please, don't, have to run, bye
Maxim
14-Jul-2010
[17353x2]
I personnally NEVER use SAVE/ALL in any manner.   I always use WRITE 
so I can't even give you a valid case for SAVE/ALL  ;-)


but I've used SAVE a few times to log data.  Even when doing script 
pre-processing, SAVE/ALL broke too often for me to afford the hassle.


I'll usually use MOLD/ALL process the data as a string with real 
control then use WRITE
and even then, I don't LOAD scripts because we loose all the comments, 
so I pretty much always use LOAD/next, & string parsing to process 
REBOL source scripts.
Andreas
14-Jul-2010
[17355]
mentioning the perceived symmetry to mold and mold/all is kind of 
evading the argument. ladislav is arguing that SAVE should be useful 
with respect to LOAD. nothing stops us from defining SAVE as WRITE 
... MOLD/ALL ..., and there is no necessity to hold up this perceived 
symmetry.
Maxim
14-Jul-2010
[17356]
btw, I *am* playing devil's advocate here... ;-)


It might be that for the general purpose, SAVE/ALL might be the better 
default.  but IMHO SAVE itself is usually inadequate for storing 
DATA.  it might be ok for storing dialect blocks though.
BrianH
14-Jul-2010
[17357]
Ladislav, if you try to DO a script saved with SAVE/all or MOLD/all, 
it will fail if it contains functions or objects. And it definitely 
*won't* be "as close to original as possible". So /all can't be the 
default for SAVE.
Andreas
14-Jul-2010
[17358]
>> save/all %foo.r load/all "foo: func [x] [x * x] foo 42"
>> do %foo.r
Script: "Untitled" Version: none Date: none
== 1764

works pretty well!
BrianH
14-Jul-2010
[17359x2]
The primary purpose of SAVE is to save scripts that are to later 
be processed by DO.
Andreas, that isn't a function, it is a description of a function.
Andreas
14-Jul-2010
[17361x2]
It's a script, you said scripts
and that's the whole point. if you load a script and then save it, 
the original script should be affected as little as possible
BrianH
14-Jul-2010
[17363]
I also said functions and objects. That means function!, closure! 
and object! values, not their source.
Andreas
14-Jul-2010
[17364]
Yes, and that's the strawman. Those literal objects will only be 
written from a script if it contained them in the first place.