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

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

Geomol
4-Aug-2007
[684]
The problem is maybe to distinguish words from other things. Is integer! 
a word? Is [gabriele-:-somewhere-:-world] a word?
Try:
blk: [integer! [gabriele-:-somewhere-:-world]]
type? blk/1
type? blk/2
Gabriele
4-Aug-2007
[685]
obviously integer! is a word
Geomol
4-Aug-2007
[686]
:-) It may not be obvious to everyone! We're in the "I'm new" group.
Gabriele
4-Aug-2007
[687x10]
there are only a few special chars
like @ and :
no, i'm saying, that you don't need a table, you just need to know 
the syntax
1) words cannot start with a digit
so, if it starts with a digit, it's not a word
2) words cannot contain " @ : $ % ( ) [ ] #
so if you have one of those chars, it's not a word
ah,    ,    too
3) / is a special case, in that / // /// //// are words, but otherwise 
you can't have it in words
there may be one or two more rules, but that's it. you don't need 
a table.
Geomol
4-Aug-2007
[697]
Good explanation!
Gabriele
4-Aug-2007
[698]
eg you can't start with   '   either
Geomol
4-Aug-2007
[699]
I still think, it will be good to have a list of examples, so it 
can be actual seen, what all this means. You and I understand it, 
but does everyone else?
Gabriele
4-Aug-2007
[700x4]
i think, these should be listed somewhere in the core guide.
hmm. examples of valid and invalid words? agreed. but it's a different 
thing from a table with all datatypes and saying that some of them 
are words - that's confusing; only values of the word! type are words.
what you say instead is that some values do not have a mold representation, 
so that they mold to something that once evaluated, returns the value 
(eg make object! ... and so on).
it's to avoid letting people grow with "wrong" ideas ;-)
Geomol
4-Aug-2007
[704]
We might move to beyond "I'm new" here, but we have a slighty different 
understanding, I think.

none is always a word

There is a possible trap here for the new one. This is output from 
my terminal:

>> blk
== [none]


Is that "none"-word a word in the REBOL understanding of a word? 
It depends on, how I made it. Did I write:

>> blk: [none]
== [none]

or did I write:

>> blk: []
== []
>> append blk none
== [none]


For the programmer being new to REBOL, it may be hard to see the 
difference. And the sentence "none is always a word" may only apply 
to the situation, where values are being fed into REBOL, not when 
I write:

>> blk
== [none]

Or what?
Gabriele
4-Aug-2007
[705x5]
that's the difference between not having a mold representation and 
having it.
none values mold to a word. so, yes, it's a word you see there.
you see a word not because there's a word in the block, but because 
none values mold to a word.
it's MOLD the issue here, not NONE!.
(neither WORD!)
btiffin
4-Aug-2007
[710x2]
Gabriele; "there is no mystery, words are just words".


I'll reiterate what John said.  It may not be obvious to everyone. 
 It's like tying your shoelaces.  Once you know, you just "know" 
and it becomes impossible to "not know".  But until then it's a mystery 
and you trip over your shoelaces.


none always looks like none.  There is nothing obvious in a: none 
 a: [none] until you trip.  Then you know, kinda.  It is very very 
easy to trip over   if first [false] ["I trip"].  The fact that false 
and #[false] are two completely different things needs to be disseminated 
to the new user, explicitly.  Mainly because in trheory it is obvious, 
in reality it is mysterious.
And as you are pointing out now...the issue is goes deep enough to 
warrant discussion among high level REBOL programmers, although perhaps 
not at the 'tieing shoelaces' level.  :)
Gabriele
4-Aug-2007
[712x3]
but if you tell newbies that sometimes none is none and sometimes 
not, you're just confusing them.
not telling the truth is always against learning
so, you just tell the truth: MOLD is cheating. just use MOLD/ALL 
to see what's actually there.
btiffin
4-Aug-2007
[715x2]
Yeah, I explained to Robert that the group here may have to suffer 
through some 'Tier B' advice  :)  There is a knack to explaining 
the deeper issues that can only come with enlightenment.   I have 
been trying to explain that the visible none is not the value none, 
but lack the vocabulary, based on the lack of deep understanding 
and experience.  It will come.
Right now, I think I'm at the stage to just know enough to be dangerous. 
 :)  This particular conversation has helped immensely in gaining 
the proper vocabulary (for this issue), the next issue is just over 
the horizon :)
Geomol
4-Aug-2007
[717x2]
:-) We're getting closer!

Ok, we have words and we have datatypes. Words are also a datatype, 
namely of the type: word!

The exercise then is to figure out, which datatypes can be put in 
a block with a simple assignment, and which are simple words, even 
if they look like being of another datatype, when they are typed 
in.
A summary of REBOL datatype values can be found here: http://www.rebol.com/docs/core23/rebolcore-16.html
PeterWood
4-Aug-2007
[719x2]
I see it from a different point of view:

A word is a value; all values have a datatype.

All values are evaluated by Rebol.

Some values evaluate directly (ie 1, 1.999)

Some values evaluate indirectly  (ie a, b c)
ie should be eg
Gabriele
5-Aug-2007
[721x2]
i'd say that differently. some values evaluate to themselves; other 
values evaluate to some other value. a paren evaluates to the result 
of DOing it. a word evaluates to the value it's bound to. a lit-word 
evaluates to the respective word. and so on.
directly
 and "indirectly" is quite vague.
Geomol
5-Aug-2007
[723]
Gabriele, what is the correct way to specify, what's happening with 
a simple block assignment, like:
blk: [a-word 123]

It's kind of partly being reduced, so 123 ends up as a number! instead 
of a word!.
PeterWood
5-Aug-2007
[724]
Why do you say that 123 ends up as a number! instead of a word! ?

>> type? 123
== integer!
Gabriele
5-Aug-2007
[725]
123 is always a number. no evaluation needed. words cannot start 
with a digit so 123 never gets loaded as a word value.
Geomol
5-Aug-2007
[726]
From the previous discussion I got the impression, that everything 
is words, when they're typed in, or viewed as output. My reasoning 
goes as: if NONE is a word when inside a block (initally without 
specifying, what we do with that block), then everything inside a 
block must be words (initially). Then the input parser take that 
block and figure out, what's inside. Some of the stuff inside ende 
up as other datatypes (in this case integer!), others are left as 
words. Or?

What I find a bit peculiar is, that things like [integer! none +] 
are left as words and not being parsed to the expected datatypes.
Gabriele
5-Aug-2007
[727x6]
no, you're wrong
when you LOAD, text is converted to rebol values. type is determined 
by syntax.
only things that have a syntax that matches a word! are parsed as 
words
123 is parsed as an integer. 123.0 as decimal. 123.1.1 as tuple. 
and so on.
values like none, true, false, etc. do not have such syntax (actually, 
it has been introduced later, and it is #[none], #[true], etc.)
a b c d ... all match the syntax for word! values and are loaded 
as such. the spelling does not matter at all. from the point of view 
of load, there is absolutely no special meaning to the word none 
or the word false. they are just word values like any other word 
value.
Geomol
5-Aug-2007
[733]
Ah, I'm beginning to see the light! If integer! shoud be seen as 
a datatype!, then it has to 'read' the on the word somehow, and if 
"!" was used to distinguish it, then I couldn't use "!" in my own 
words. And none is just a word, nothing special about it's presense. 
And I could have my own none values, like: my-none: :none

But but but ... why doesn't it look it up and see, if that word has 
a value? Will that give problems? *thinking*