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

World: r3wp

[Core] Discuss core issues

Geomol
22-Jul-2011
[1819x3]
I don't see doc about C datatypes in struct! spec block. I guess, 
it's the same rules as in routine spec block?
Example, where I use the C datatype, int:
	>> s: make struct! [i [int]] [42]
About constructs, off my head I have:
	#[none] #[true] #[false]

Are there others?
Gabriele
23-Jul-2011
[1822]
>> #[binary! "abc"]
== #{616263}
>> #[bitset! #{010203}]
== make bitset! #{010203}
>> #[block! [1 2 3 4] 3]
== [3 4]
>> #[email! "something"]
== something
>> #[file! "something"]
== %something
>> #[function! [a b] [a + b]]
** Script Error: none is missing its a argument
** Near: func [a b][a + b]

... and so on
Geomol
23-Jul-2011
[1823]
Is this documented anywhere?
Sunanda
23-Jul-2011
[1824]
Perhaps not, geomol. See this cc thread:
   http://curecode.org/rebol3/ticket.rsp?id=941
Ladislav
23-Jul-2011
[1825x4]
The "serialized" word is very inappropriate, e.g.:

    /all "Mold in serialized format"


does not say anything at all, since the format without the /ALL refinement 
is serialized as well (it is a text string).
Some other inappropriate notions:

   "serialized constructors", when used for #[none]


e.g. is a very unfortunate notion, since it is not a constructor 
(=a special function), not to mention, that it surely is not a serialization 
of such a function.
(my notes apply to the text of the curecode discussion to the above 
mentioned ticket)
Fortunately, according to Carl's note, the correct notion for the 
#[none] and similar formats seems to be:

    "specially escaped format"
Henrik
23-Jul-2011
[1829]
Does serialization not imply there is a reverse action for it? Only 
MOLD/ALL will allow that.
Ladislav
23-Jul-2011
[1830x5]
Hmm, that looks like a proper objection, but it does not take into 
account, that e.g.

    123


is a result of both MOLD as well as MOLD/ALL and it surely is serialized, 
while e.g.

    #[none]


is not just "serialized", it is a "specially escaped format", as 
noted by Carl
Moreover, MOLD usually does preserve REBOL code in the sense, that 
you get the same program when loading the result of MOLD more often 
than not.
While even MOLD/ALL does not look "reversible enough" for some functions, 
objects, etc.
For all the above reasons, it is much better to call the #[none] 
and the likes "specially escaped format" rather than "serialized 
constructors".
The unfortunate thing is, that there is the MOLD vs. MOLD/ALL ambiguity, 
which confuses every beginner exactly because when they encounter

    none


they usually think it is a REBOL value of the type NONE!, which may 
mislead them in many cases
Henrik
23-Jul-2011
[1835]
do we have both MOLD and MOLD/ALL for performance reasons?
Ladislav
23-Jul-2011
[1836]
I do not think there are performance reasons for that.
Henrik
23-Jul-2011
[1837x2]
why do we then have MOLD and FORM?
rather: why do we have MOLD at all? I'm not sure we can say that 
it preserves REBOL code, because, surely, MOLD/ALL preserves more 
of it.
Ladislav
23-Jul-2011
[1839]
For example, if MOLD/ALL were used to display the result of an expression 
we would obtain:

    none
    == #[none]

, which would be less confusing than

    none
    == none
Henrik
23-Jul-2011
[1840x2]
but we use FORM for that, don't we?
the only place that I find use for MOLD is when wanting to preseve 
brackets when displaying a block. otherwise I use FORM or MOLD/ALL
Ladislav
23-Jul-2011
[1842]
no, MOLD is used to display the result of REBOL expressions as far 
as I know
Henrik
23-Jul-2011
[1843]
That's not how I originally understood it, when I first read about 
them. Displaying values was the intent with FORM as it does not necessarily 
produce REBOL readable output, but human readable output. MOLD was 
meant to be used for serialization, so that the data could be re-read 
by REBOL.

Indeed, the help strings:

FORM: Converts a value to a string.
MOLD: Converts a value to a REBOL-readable string.
Ladislav
23-Jul-2011
[1844x2]
>> print ["==" mold "a^^b"]
== "a^^b"
>> print ["==" form "a^^b"]
== a^b
So, it is clear, that MOLD is used, not FORM
Henrik
23-Jul-2011
[1846]
you mean, when returning a value to the console?
Ladislav
23-Jul-2011
[1847]
you mean, when returning a value to the console?

 - it is not "returning a value to the console", it is "to display 
 the result of a REBOL expression in the console"
Henrik
23-Jul-2011
[1848]
that's different than "human readable output":

>> "a^^a"
== "a^^a"

>> print "a^^a"
a^a
== "a^^a"
Ladislav
23-Jul-2011
[1849]
'that's different than "human readable output":' - I do not understand 
what you are after saying that
Henrik
23-Jul-2011
[1850]
the output is clearly different from PRINT than from MOLD.
Ladislav
23-Jul-2011
[1851]
The current state: 


- MOLD is used to display the result of REBOL expression to the console.
- I prefer MOLD/ALL to be used, since it would be less confusing
- do you mean, that you would prefer FORM?
Henrik
23-Jul-2011
[1852]
I'll rephrase:


What I have a problem with, is that there are apparently degrees 
of serialization:


One that we call MOLD, but doesn't really work on all REBOL data. 
I very rarely use this alone.

One that we call MOLD/ALL, and works on nearly all REBOL data. I 
use this very often.


Then we have FORM, which should work on human readable output. The 
problem with FORM is that it isn't flexible enough. For example it 
should have been capable of reformatting numbers, such as 2E-3 to 
".002". It doesn't do that.
Steeve
23-Jul-2011
[1853]
R3 does
Ladislav
23-Jul-2011
[1854]
Yes, R3 does (I wrote the code, as far as I remember), but it is 
arguable, whether it is true, that ".002" is human readable, while 
"2e-3" isn't.
Henrik
23-Jul-2011
[1855]
I know that everything is human readable to Ladislav, that's for 
sure. :-)
Ladislav
23-Jul-2011
[1856x2]
Not everything, *that* is for sure.
Nevertheless, for me, "1e9" is more human readable than "1000000000"
Henrik
23-Jul-2011
[1858]
yes, I know it is for you. :-)
Ladislav
23-Jul-2011
[1859]
I guess, that it is for everyone having trouble to count the zeros.
Steeve
23-Jul-2011
[1860]
I must agree Ladislav event if it hurts ;-)
Ladislav
23-Jul-2011
[1861]
LOL
Henrik
23-Jul-2011
[1862]
Nevertheless, there is reason to have good native support for any 
numeric format, correct? You and I know that our NLPP app suffers 
performance wise over this, having to use FORM-DECIMAL. Don't you 
think that FORM is a good candidate for assigning it to be only for 
human readable output?
Steeve
23-Jul-2011
[1863]
NLPP ?
Henrik
23-Jul-2011
[1864]
RM Asset product.
Ladislav
23-Jul-2011
[1865]
I am afraid, that there is no universal format usable for every application 
one may write.
Steeve
23-Jul-2011
[1866]
It's likely country varying
Henrik
23-Jul-2011
[1867]
Then, does it not make sense to have configuration for this, which 
FORM would use?
Robert
23-Jul-2011
[1868]
I thought several times to implement FORM-DECIMAL in C and support 
the different country styles. Should be queried from the OS. And 
yes, all Rebol functions should be aware of this.