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

World: r3wp

[Core] Discuss core issues

Izkata
21-Feb-2009
[12462]
It's always felt consistent to me - the context is being evaluated, 
and lit-word!s reduce to word!s, word!s reduce to functions and values, 
while other datatypes reduce to themselves:
>> X: [{One} 'Two]
== ["One" 'Two]
>> ? X/1 ? X/2
X/1 is a string of value: "One"
X/2 is a lit-word of value: 'Two

>> X: reduce X   ;Here is where typing it in on the terminal evaluates 
to
== ["One" Two]
>> ? X/1 ? X/2
X/1 is a string of value: "One"
X/2 is a word of value: Two
>> X: reduce X
** Script Error: Two has no value
** Near: Two

...and the reasoning behind lit-word!/word! acting differently is 
that those are special datatypes where other values can be bound 
to them
[unknown: 5]
21-Feb-2009
[12463x2]
My point is that I don't see why the to-lit-word isn't implied when 
performing assignment.  Such as a: 'test
BTW, it is more efficient to assign a lit-word with a: first ['test] 
then it is to use a: to-lit-word 'test.
Janko
21-Feb-2009
[12465x3]
(I participatted in this discussion already one time and it also 
seems consistent to me)
Paul: I think Brian or Henrik told that time that 'word is "active" 
something and rebol reduces it when encounters it in the same way 
as it would auto-reduce function a: get-two not assign it to a (at 
least that was my compilation of it that time :) )
and we all know that blocs don't get evaluated / reduced by itself 
so [ word ]  stays [ word ] even fi word is undefined or func or 
anything so [ 'word ] also stays [ 'word ]
[unknown: 5]
21-Feb-2009
[12468x2]
That makes no sense to me Janko.  By the way it was me and Henrik 
that both thought it was inconsistent.
Janko, this seems consistent to you:

>> lit-word? 'test
== false
Janko
21-Feb-2009
[12470]
it maybe seems odd at first sight, but consistent in the same way 
as this:

>> make-two: does [ 2 ]
>> make-two
== 2
>> function? make-two
== false
Rebolek
21-Feb-2009
[12471]
Paul, it is consinstent:

read first word - it's >lit-word?<
evaluate it - it's a function that takes one argument

read second word (first and only argument for that function) - it's 
>'test<
evaluate it - lit-word! evaulates to word!
pass it to the function - word! is passed, not lit-word!
[unknown: 5]
21-Feb-2009
[12472]
Ok, if everyone else thinks so then this is one of those issues where 
its only me that thinks it isn't.  As long as newbies GET IT when 
learning REBOL that is what matters.
Janko
21-Feb-2009
[12473x2]
I am not so exp. rebol user as you but where do you use lit words 
as they are.. I used them only to pass words (reduced lit-words) 
basically so far ... in blocks never

 write  [  'some 'random 'words ]  but  [ some random words ]  as 
 they don't get evaled anyway
Paul: maybe you have a different usage pattern for them, so this 
behaviour that goes on looks odd/wrong when used that way?
[unknown: 5]
21-Feb-2009
[12475x4]
yes Janko but that can be risking if they do get evaluated.  consider 
this [delete %/c/bootmgr]
See I read the documentation on lit-word? and it states:

Returns TRUE for lit-word values.
But you guys tell me that 'test is not a lit-word value.
That is what doesn't make sense to me.
Janko
21-Feb-2009
[12479x2]
yes, I get this delete example :) good point ,... I would have to 
look in what manner I used blocks with "random" words (if I did) 
to see what could happen..  I did some when I was playing with dialects.. 
and to store data in [ key "value" ]  manner
is make-two a function ? it is but when you write it it gets evaled 
to 2 and if you write >>function? make-two<< you get false , same 
here it is but it get's evaled to word
[unknown: 5]
21-Feb-2009
[12481x2]
But 'test is a value - not a function.  It is the end value as I 
call it.  In other words it doesn't evaluate.
words can evalute but lit words don't.
Rebolek
21-Feb-2009
[12483]
no, lit words evaluate to words
[unknown: 5]
21-Feb-2009
[12484x4]
I know it does which is why I believe that is inconsistent.
I currently get this:

type? 'test
==word!

I think it would be more consistent to get this:

type? 'test
==lit-word!
Consider this link by Brett:

http://www.codeconscious.com/rebol/articles/rebol-concepts.html

It says the following:

'age

This textual form is recognised in rebol as the lit-word! datatype.
See that isn't entirely true - only half true.  Consider:

>> lit-word? 'age
== false
Rebolek
21-Feb-2009
[12488]
But this is purpose of lit-word! With your behaviour,
>> reduce ['a] ; would return
== ['a]
[unknown: 5]
21-Feb-2009
[12489x3]
But that makes sense to me.
That is why I say that it is only half true to say that it evaluates 
to a lit-word.
It does sometimes but not all the time.
Rebolek
21-Feb-2009
[12492x2]
No, it evaluates to word!, not lit-word!
Always
[unknown: 5]
21-Feb-2009
[12494]
To me that is the inconsistency.
Rebolek
21-Feb-2009
[12495]
Paul, with your behaviour, how would you write this code?:

>> a: 3
== 3
>> reduce ['a a]
== [a 3]
[unknown: 5]
21-Feb-2009
[12496x2]
to me it should be ['a 3]
But I know that  breaks how REBOL works.
Janko
21-Feb-2009
[12498]
but then 'a would be very similar to just string "a" in behaviour... 
don't lit words exist exactly for the behaviour that they have?
[unknown: 5]
21-Feb-2009
[12499x2]
And REBOL does see 'test as a lit-word.  A trace shows this:

>> string? 'test
Trace:  string? (word)
Trace:  'test (lit-word)
Result: false (logic)
== false
Yes Janko, it would be intended in that behavior which again is why 
it would break how REBOL works.
Izkata
21-Feb-2009
[12501]
Does this help?  X contains the code you see and type, the lit-word! 
typed in.  It gets reduced to its word value..
>> X: [type? 'one]
== [type? 'one]
>> type? X/2
== lit-word!
>> do X
== word!
[unknown: 5]
21-Feb-2009
[12502x6]
I'm not arguing about how lit-words are used.  I'm arguing about 
how lit-word? detects lit-word.
The rest is understood that it should work they way it should be 
cause of the manner of words in REBOL.  But the function of lit-word? 
is what to me seems inconsistent.
I understand all of that IzKata.  I have been using REBOL since 1998 
now.
That part has remained pretty much the same.
My argument lies specifically with the lit-word? function.
What is wrong in having lit-word? return True in this case:

lit-word? 'test
==true
Janko
21-Feb-2009
[12508]
but argument to lit-word? in your case is not lit word , it can't 
return true vithout magic 

>> 'test
== test (this is what lit-word? recieves in)
[unknown: 5]
21-Feb-2009
[12509x2]
Yes it is Janko, a TRACE shows that my argument  is a lit-word.
If you were correct Janko then how would Trace know to classify my 
argument as a lit-word?
Janko
21-Feb-2009
[12511]
how do you make this trace (I never used it, and also don't understand 
what exactly it shows)