Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] word datatype was contexts

From: rotenca::telvia::it at: 17-Sep-2001 14:07

> again, Romano,
hi, Joel, Thank you for the explanation, now i see things more clearly.
> Actually, it does... In the on-line version of RCUG (the > quickest one for me to check), section 5.1 "Word Names", > begins with the statements: > > Words are composed of alphabetic characters, numbers [sic], > and any of the following characters: > > ? ! . ' + - * & | = _ ~ > > A word cannot begin with a number [sic], and there are > also some restrictions on words that could be interpreted > as numbers. For example, -1 and +1 are numbers, not words.
Yes, i've found it. Appendix A-79.
> The statements you quoted above from RCUG are really talking > about the standard rules by which REBOL translates text into > internal values. They don't mean that that you can't override > the normal assumptions and force REBOL to create values (e.g. > words) out of something that doesn't follow the standard rules.
They don't say neither than horse can fly.... :-)
> >> confusion: reduce [to-set-word "%yikes" 2.54] > == [%yikes: 2.54] > >> do confusion > == 2.54 > >> print %yikes > yikes > >> type? %yikes > == file! > > What's happening? We forced the creation of a word whose > spelling is not "normal" because it begins with a percent > sign (normally used as a prefix to indicate file names). > Therefore, when we say PRINT %YIKES at the interactive > prompt, REBOL applies the normal rules and translates the > next thing after PRINT into a file name.
I forgot than the input from console go to Load which applies "normal rules"...
> In order to get > back to the word we created with the non-standard name, we > have to override the rules again... > > >> print get to-word "%yikes" > 2.54
And also:
>> get first confusion
== 2.54 in this case I over-pass Load. But there is another thing: every datatype has own rules, we can't trasform anything in anything. to-issue put always (i think) a "#" in front of any string, you can't force this. to-integer doesn't like the number: "i'm not a number" So, some rules exist for every datatype. The only rule i can find for word! is length? string >0 Conclusion: we can't made any assuntion on the mold format of any word. But now i ask me: what are the true rules (beyond Load) of every datatype?
> Hope this helps!
Very, very useful and clear!
> -jn-
--- Ciao Romano