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

World: r3wp

[Core] Discuss core issues

Andreas
14-Jul-2010
[17429]
And based on that, the problem is: load + save does not preserve 
the original data correctly
Ladislav
14-Jul-2010
[17430]
Regardless of #[true], as demonstrated on decimals
BrianH
14-Jul-2010
[17431]
Andreas, decimal is a special case in that the regular syntax which 
can specify every value representable in memory, also can specify 
values which aren't representable, which have to be approximated. 
And since those approximated values include much of what developers 
actually use, the aproximation is undone when the value is saved 
in the form which is supposed to result in ordinary source code.
Maxim
14-Jul-2010
[17432x2]
which is why some values wrap to 0.1 even though that value isn't 
representable within memory... it should be 0.999999999999999... 
 IIRC
when I say "it should be" I mean the real value in memory
Ladislav
14-Jul-2010
[17434]
Yes, that looks as a reasonable explanation, but, as I said, it transforms 
the script:

rebol [] same? 0.10000000000000001 0.10000000000000002

yielding #[false] into:

rebol [] same? 0.1 0.1

yielding #[true]


If I had to use a script preprocessor doing this, I would rather 
jump under a moving magnetophone tape, as a friend of mine told once
Andreas
14-Jul-2010
[17435x2]
the approximation is undone

 is an euphemism. more precisly a transformation is applied which 
 also transforms values that are perfectly reprensetable in memory
and therefore have not had to be "approximated" in the first place. 
0.10000000000000002 demonstrates this
Ladislav
14-Jul-2010
[17437]
euphemism
 is pregnant, yes
BrianH
14-Jul-2010
[17438]
Ladislav, a clarification: The DED has a semantic model, but it doesn't 
exactly match the in-memory model. And there is currently no function 
that can generate a serialized form of the in-memory model, and no 
function that can recreate the in-memory model from a serialized 
form (in this case "serialized" being used in its accepted meaning 
rather than the REBOL "serialized syntax" term). MOLD and MOLD/all 
are just approximate, as is LOAD. DO is a bit more accurate, but 
there is no function that can generate DO code from *all* in-memory 
structures, just some of them; the rest currently have to be written 
manually. So what we need is a function that does a better job of 
serializing the in-memory data model, and probably a new syntax to 
represent it.
Maxim
14-Jul-2010
[17439]
I think we could just extend the serialized form to represent just 
about everything in-memory.
Andreas
14-Jul-2010
[17440x2]
the best argument I heard in this discussion _against_ the sequence 
of load + save behaving as transparently as possible is that this 
is not at all intended in the first place! except, the argument gues, 
the intended design is for save to be symmetric to mold.
Brian: would you mind describing a single _semantic_ aspect of the 
the DED's model?
BrianH
14-Jul-2010
[17442]
1 represents an "integer".
Andreas
14-Jul-2010
[17443]
What is semantic about that?
Ladislav
14-Jul-2010
[17444]
So what we need is a function that does a better job of serializing 
the in-memory data model, and probably a new syntax to represent 
it.

 - actually not, as I have no problem to demonstrate, since the goal 
 of script preprocessing (which is the subject of this discussion) 
 can be reasonably achieved using the LOAD and SAVE/ALL pair.
Andreas
14-Jul-2010
[17445]
1 is syntax for the "integer!" type, no semantics involved. The whole 
point of _data_ is that it has no semantics but a syntactic structure. 
That may not be REBOL's standard terms, but computer science instead.
BrianH
14-Jul-2010
[17446x2]
Ladislav, script preprocessing doesn't require the whole range of 
in-memory data structures, just a subset. What I am talking about 
is outside of that subset.
Andreas, the integer! type is a semantic concept. As is nested blocks.
Andreas
14-Jul-2010
[17448]
a syntactic category is per definition no semantic concept. but that's 
really getting off-topic here.
Steeve
14-Jul-2010
[17449]
semantic battle
Andreas
14-Jul-2010
[17450]
We are only concernce with this subset of data structures and we 
see that LOAD + SAVE in sequence does not adequately preserve even 
those.
Ladislav
14-Jul-2010
[17451]
Steeve, that is exactly a false impression, the original topic is 
about REBOL syntax preservation, all semantic detours are off-topic
Andreas
14-Jul-2010
[17452]
And the argument is that a pair of functions with the names of LOAD 
and SAVE which pretty much cry *duality* is to be considered harmful 
if they willingly violate their implied duality.
Steeve
14-Jul-2010
[17453]
but you both use a different semantic to argue around your subject
BrianH
14-Jul-2010
[17454x2]
Taking the decimal! type as an example, the DED syntax (what LOAD 
can handle) can accept a wider range of decimals than can be represented 
in-memory. Those that can't be represented directly in memory are 
approximated. Since those approxiimations tend to happen in the 16th 
to 17th digits, they can be "undone" by ignoring those digits in 
the "friendly" output.
If you want to consider LOAD and SAVE not being a duality to be harmful, 
go ahead, considerations like that are a matter of opinion.
Andreas
14-Jul-2010
[17456]
This "unapproximation" is simply broken then.
BrianH
14-Jul-2010
[17457x2]
Yes, Andreas, that is what I have been saying.
But they are still useful, even if they are limited.
Andreas
14-Jul-2010
[17459]
They are not limited, they are broken.
Ladislav
14-Jul-2010
[17460]
Right, since it "unapproximates" all values, i.e. values, that aren't 
"approximated". Therefore, it either can be called a "broken unapproximation", 
or, more precisely, no unapproximation at all,since it actually is 
not "unapproximation"
BrianH
14-Jul-2010
[17461]
Reapproximation for MOLD, no approximation for MOLD/all, approximation 
depends on the digits for LOAD, at least for decimals.
Ladislav
14-Jul-2010
[17462]
Well, is that worh any discussion? The transformation clearly transforms 
values so, that after being transformed, additional error is introduced.
BrianH
14-Jul-2010
[17463x2]
Maxim, we can't extend the existing serialized form to represent 
everything in memory, because binding, cycles and DAGs aren't representable 
without some kind of reference index. So even rebin wouldn't do, 
we'd need something like RIF.
Ladislav, it was just an example to illustrate that the abstract 
REBOL that is accepted by LOAD doesn't exactly represent the real 
REBOL in memory. But it does represent enough to do source processing 
by a preprocessor.
Andreas
14-Jul-2010
[17465x3]
If you want to consider LOAD and SAVE not being a duality to be harmful, 
go ahead, considerations like that are a matter of opinion.
Ha, at least we got to the point. This opinion was all this discussion 
was originally about.
As a matter of fact, LOAD and SAVE/all form a far better duality 
as far as REBOL source is concerned. So Ladislav and I argued that 
making /all the default for SAVE would be a sensible thing to do.
BrianH
14-Jul-2010
[17468]
The problem with that is that opinions vary. This has been happening 
a lot lately. Just the other day, Sunanda claimed in CureCode that 
assignments were unsafe. I couldn't even answer a statement like 
that without it turning into a flame war.
Andreas
14-Jul-2010
[17469x2]
Sure, that's why we are discussing it at all. Besides getting mightily 
side-tracked in semantic debates that do mostly not pertain to this 
issue, to only argument against this suggestion I heard was that 
SAVE should behave symmetrically to MOLD, not dually to LOAD.
A nice result of this side-tracking is that I now consider mold completely 
broken for decimals, as it applies a hack that maybe once was appropriate 
for single precision floats, but certainly no longer is for double 
precision floats.
BrianH
14-Jul-2010
[17471]
SAVE and MOLD are explicitly designed to be newbie-friendly - that 
includes being able to have MOLD generate the value 0.1, which is 
not representable by the (misnamed) decimal! type in memory. And 
#[] syntax has been judged to not be newbie-friendly, or at least 
an ugly thing that only power users do. If you want to reverse that 
decision, fine, but it's unlikely.
Andreas
14-Jul-2010
[17472]
Once again, 0.1 is not the point here. That's the result of a flawed 
pretty-printer.
BrianH
14-Jul-2010
[17473]
>> mold/all 0.1
== "0.10000000000000001"

Many values that developers usually write out in decimal aren't representable 
in memory. Welcome to the wonders of IEEE754.
Andreas
14-Jul-2010
[17474x2]
Funny, what platform?
>> mold/all 0.1
== "0.1"
BrianH
14-Jul-2010
[17476]
Andreas, you are not getting that the whole point of MOLD and SAVE 
is to be a pretty-printer.
Ladislav
14-Jul-2010
[17477]
Windows
Andreas
14-Jul-2010
[17478]
What is FORM supposed to be then?