@Ladislav: Why quote function acts different in R2? age: 35 ;=3D=3D 35 quote age ;=3D=3D 35 ,in R3 =3D=3D age
If quote function would be as below, does it act as expected? (in R2) quote: func ['v] [:v] quote age ;=3D=3Dage Thu, 02 Dec 2010 17:55:18 +0200 tarihinde Ladislav Mecir <[email protected]= z> = =FE=F6yle yazm=FD=FE: > > #[[Duke > Hello List.... > Duke]] - hi, your questions deserve good answers, and I hope you find = my > notes below at least a bit helpful. > > #[[Duke > First of all, the term "form" is confusing to me. Would someone give > me an appropriate synonym. > Duke]] - if I understood you well, you did not want a "synonym" for > "form", rather you wanted to have a proper notion to refer to differen= t > word types. In my opinion, the proper notion is either "datatype", or > "word type". > > #[[Duke > I understand that a Rebol "word" is not a variable bound to a datatype= > as in other programming languages. It is merely the "name" of a > container which can hold any Rebol datatype; which itself has the > "word!" datatype. > Duke]] - this is not something you should worry much about. Words are > REBOL values of their own right, but they *can* be used as variables, = to > refer to other REBOL values, also. > > #[[Duke > Assuming the Rebol word "age", if I want to have the name of the > container returned to me, I would use the syntax (form) 'age. Correct?= > Where does the "lit-word" datatype come in? I don't get the > terminology! > Duke]] - hmm, this may be quite hard to explain, so, let me introduce > the QUOTE function to you. This function takes any argument (in R3) > without allowing the DO function (or some of other common evaluators) = to > evaluate it. Thus, from the QUOTE function we get exactly what we give= . > Example: > > >> type? quote age > =3D=3D word! > > >> quote age > =3D=3D age > > So, to obtain the word age you mentioned above, we can use the word an= d > pass it to the QUOTE function. > > That is not the only way, how to obtain the word age, though, there is= > yet another way: > > >> type? 'age > =3D=3D word! > > >> 'age > =3D=3D age > > This is what you may encounter more frequently, but, in fact, the > processing is more complicated, than when using the QUOTE function, > since, when we examine: > > >> type? quote 'age > =3D=3D lit-word! > > >> quote 'age > =3D=3D 'age > > we see, that 'age is actually not a word, it is a lit-word! Why, then,= > the expression 'age yields a word, not a lit-word? The reson is, that > every REBOL value is processed (evaluated) somehow by the DO function,= > unless such an evaluation is prohibited by using e.g. the QUOTE functi= on. > > And, the evaluation of a lit-word is done so, that the said lit-word i= s > processed, yielding its corresponding word. > > #[[Duke > If I want to have assign something to the "age" container, I would > use: > > age: 35 > > is the ":" the "set-word!" datatype. > Duke]] - no, not at all, the age: value is a set-word, as can be seen > when trying: > > >> type? quote age: > =3D=3D set-word! > > >> quote age: > =3D=3D age: > > And, this set-word, when processed by the DO function, causes the age > variable to refer to the integer value 35, which also becomes the resu= lt > of the expression. > > #[[Duke > If I want the "contents" of age, I would use: > > :age and have 35 returned to me. is the prefixed ":" the "get-word!" > datatype? > Duke]] - I refer you to the above explanation, this is just an > analogical situation. > > #[[Duke > I'm getting all balled up with the terminology - how is an "action" - > like "get the contents of the word called "age", a datatype? > ]] - the :age REBOL value has a datatype. The "action" you mention tak= es > effect only when the DO function (or some other similar function) > processes the value. > > #[[Duke > Also, what's the difference between using: > > age: 45 > > SET age 45 > Duke]] - this time, for the expressions to have a similar effect, you > need to write: > > age: 45 ; i.e. you have this right > set 'age 45 ; since 'age is processed becoming age before being passed= > to SET > ; or, alternatively: > set quote age 45 > > -Ladislav -- To unsubscribe from the list, just send an email to lists at rebol.com with unsubscribe as the subject.
