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

World: r3wp

[Core] Discuss core issues

[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)
Izkata
21-Feb-2009
[12512x2]
Trace shows what the rebol interpreter first finds, not what a datatype 
evaluates to:
>> type? 'test
Trace:  type? (word)
Trace:  'test (lit-word)
Result: (datatype)
== word!
Janko:
>> trace on
Result: (unset)
>> 'test
Trace:  'test (lit-word)
== test
[unknown: 5]
21-Feb-2009
[12514]
Yes Izkata, it finds that 'test is a lit-word.
Izkata
21-Feb-2009
[12515x2]
And the interpreter converts it to a word! before passing it to 'lit-word?
so lit-word? never sees a lit-word!
[unknown: 5]
21-Feb-2009
[12517x3]
Yes, I understand that.  But that is not what it was given.
Again, I'm saying what is wrong with having the lit-word? function 
return true for a lit-word value?
Obviously the interpreter can see that it is a lit-word value even 
BEFORE it calls it a word! value.
Izkata
21-Feb-2009
[12520]
But it does:
>> X: ['Test]   
== ['Test]
>> lit-word? X/1
== true
[unknown: 5]
21-Feb-2009
[12521x2]
Yes, I know Izkata in that case but that  is not consistent with 
this one:

lit-word? 'test
==false
Nobody is answering my question though - what is wrong with having 
lit-word? return true in the case above?
Izkata
21-Feb-2009
[12523x2]
Because it never sees an actual lit-word! - all the other (datatype)? 
functions do.
never actually sees*
[unknown: 5]
21-Feb-2009
[12525x2]
Trace shows that it does see it as a lit-word
>> 'test
Trace:  'test (lit-word)
== test
Izkata
21-Feb-2009
[12527x2]
Trace shows that the interpreter - not the lit-word? function - sees 
a lit-word before it gets evaluated
not after
[unknown: 5]
21-Feb-2009
[12529x2]
Exactly!!!  So why don't we modify lit-word? function so that it 
can say true when it sees it?
See if I asked someone to tell me what type this is:

'test


They would most likely respond a lit-word.  So shouldn't the lit-word? 
function say the same?  I say it should.
Izkata
21-Feb-2009
[12531x2]
Rebol, the interpreter, sees a lit-word!.  Trace shows this.  It 
*then* evaluates it to a word!, *then* passes it to lit-word?, and 
lit-word? never sees the original lit-word!
I would ask if it's a line of code or data
[unknown: 5]
21-Feb-2009
[12533x3]
Trace doesn't show that it evaluates it to a word.  I don't know 
where you get that.
If it did, then I would think that Trace woudl show that but it doesn't 
- again:

>> 'test
Trace:  'test (lit-word)
== test
nothing about it being word! in that trace.
Izkata
21-Feb-2009
[12536]
Exactly, trace doesn't show that.  Trace doesn't show everything.
[unknown: 5]
21-Feb-2009
[12537]
Well then how can we be sure that is the case?
Izkata
21-Feb-2009
[12538]
>> Gettype: func [A][print type? A  return A]
>> lit-word? Gettype 'Test                   
word
== false
[unknown: 5]
21-Feb-2009
[12539]
In other words how do we not know that the native lit-word? function 
couldn't be modified to in fact report true in this case?
Izkata
21-Feb-2009
[12540]
Unless large modifications are made to the language itself, it would 
also start returning true for regular word! values
[unknown: 5]
21-Feb-2009
[12541x4]
Well that is my Izkata, how do we know that - are we just assuming 
that?  I mean we know that it can handle the data as a lit-word while 
it is in an unevaluated block.
For example, why can first ['test] return lit-word then?
Surely we can return true with a modification to lit-word? function 
to do the same for lit-word? 'test
Izkata, let my pose a hypothetical question to you.  If lit-word? 
could return TRUE to this statement:

lit-word? 'test

Would you desire that ability?
Izkata
21-Feb-2009
[12545]
No, as I would then never know if something's datatype was a word! 
or a lit-word!
[unknown: 5]
21-Feb-2009
[12546]
sure you would.  a word that doesn't have the tick in front of it 
woudl be a word!
Oldes
21-Feb-2009
[12547]
No
Rebolek
21-Feb-2009
[12548]
first is function! that gets evaluated. it takes one argument - block! 
that argument is also evaluated and block! is evaluated to block!. 
then it returns first value of that block. this value is not evaluated 
- but that's ok, it's 'first's behaviour