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

Ladislav: Interpreter Essay

 [1/13] from: robbo1mark::aol::com at: 16-Oct-2001 3:16


Hello Ladislav, Just read your new Interpretation essay, very good work, I love the way you can skillfully describe low level REBOL behaviour with high level descriptions and examples and for this you deserve credit. Just one minor improvement I would like to suggest to your text. You stated "When the interpreter finishes evaluation of all values contained in the block, the last obtained value becomes the result." Almost true, but not quite. What if the last value in a block is unset!
>> reduce [print "Hello"]
Hello == [unset]
>> do [print "hello"]
hello
>>
In these instances, where the interpreter finds an unset! value it EXIT's without returning any value, prints the system/console/prompt and a new evaluation / interpreter loop begins. My 'do-example function source below should mimic the interpreter behaviour. do-example: func [x][x: reduce x if block? x [either unset? last x [exit] [return last x]] return x]
>> do-example [ 1 print "Hello"]
Hello
>> do [ 1 print "Hello" ]
Hello
>>
Seems to work fine, otherwise great essay! Thanks Ladislav. Mark Dickson

 [2/13] from: steve:shireman:semaxwireless at: 16-Oct-2001 5:58


May I ask where this essay is located? Thanks, Steve Shireman [Robbo1Mark--aol--com] wrote:

 [3/13] from: lmecir:mbox:vol:cz at: 16-Oct-2001 14:04


Hi Steve,
> May I ask where this essay is located? > Thanks, > Steve Shireman
My essays are on Reb/Ladislav(preferable). This is: http://www.sweb.cz/LMecir/interpret.html Cheers Ladislav P.S. I would prefer Set-words to behave like Get-words, instead of being Word-active. It would be more reliable. What do you think?

 [4/13] from: lmecir:mbox:vol:cz at: 16-Oct-2001 16:10


Hi Mark,
> You stated "When the interpreter finishes evaluation of all values > contained in the block, the last obtained value becomes the result." > > Almost true, but not quite. What if the last value in a block is unset!
I think, that it is true. See:
>> type? do [print 1]
1 == unset! Cheers Ladislav

 [5/13] from: robbo1mark:aol at: 16-Oct-2001 11:01


Hi Ladislav, I still think my original posting is correct as DO does EXIT if the last value in a block is an UNSET values. In your example UNSET! is a datatype! value NOT an UNSET value. See ....
>> type? do [print 1]
1 == unset!
>> type? type? do [print 1]
1 == datatype!
>> unset? type? do [print 1]
1 == false
>> reduce [ do [print 1]]
1 == [unset] Again it's the distinction between UNSET & UNSET! Whether this should be visible at the user level of REBOL well that's a whole diferent story. Always good to speak to you Ladislav, Cheers & best wishes, Mark

 [6/13] from: lmecir:mbox:vol:cz at: 16-Oct-2001 17:54


Hi Mark, I may not understand what you are trying to tell me, but I was saying, that all the following Rebol expressions: ; # 1 print 1 ; # 2 do [print 2] ; # 3 () ; # 4 f: does [exit] f ; # 5 first reduce [()] all yield identical Rebol value. The value in question has the UNSET! datatype. Cheers Ladislav

 [7/13] from: robbo1mark:aol at: 16-Oct-2001 12:31


Ladislav, sorry about the confusion, I your new essay you said that DO returns the last value in a block! as the result. But you can never get UNSET returned as the result of an expression ie == unset sure you can get == [unset] or == unset! but these are block! and datatype! values. When DO encounters the UNSET value which has the UNSET! datatype it EXITS to the system console prompt. ie
>> do reduce [print 1]
1
>>
We don't get
>> do reduce [print 1]
1 == unset That's all I was trying to say. That in these instances for all intents and purposes there is NO "Result". That's all, just trying to make your essay more precise. Sorry if I've wasted yor time, Iam sure we both know the pitfalls of UNSET all too well. cheers, Mark In a message dated Tue, 16 Oct 2001 12:08:03 PM Eastern Daylight Time, "Ladislav Mecir" <[lmecir--mbox--vol--cz]> writes:

 [8/13] from: lmecir:mbox:vol:cz at: 16-Oct-2001 21:54


Hi Mark, you didn't waste my time.
> But you can never get UNSET returned as the result of > an expression ie > > == unset
That is an error, IMO. There are expressions that yield the (Unset) value. The only difference between this value and any other value is, that the interpreter, when an expression yields the (Unset) value, doesn't print == unset at the console. Nevertheless, you can easily make sure, that a block like [print 1] really yields the (Unset) value when evaluated. Cheers Ladislav

 [9/13] from: g:santilli:tiscalinet:it at: 17-Oct-2001 14:06


[Robbo1Mark--aol--com] wrote:
> I still think my original posting is correct as DO > does EXIT if the last value in a block is an UNSET values.
Actually, is the other way around. EXIT just returns and UNSET! value. In REBOL every function returns something, even if this something is an UNSET! value (which means "I didn't return anything useful").
> Again it's the distinction between UNSET & UNSET! >> first reduce [print "Hi!"]
Hi!
>> type? first reduce [print "Hi!"]
Hi! == unset!
>> datatype? first reduce [print "Hi!"]
Hi! == false
>> datatype? do [print "Hi!"]
Hi! == false I can't see any difference here. HTH, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

 [10/13] from: robbo1mark:aol at: 17-Oct-2001 8:36


Hi Gabrielle, UNSET! is the datatype! of an UNSET value and is a valid useable value The value UNSET is a value but is unuseable and as you rightly say equivalent to returning "NO" value. I think we all agree? Mark In a message dated Wed, 17 Oct 2001 8:16:24 AM Eastern Daylight Time, Gabriele Santilli <[g--santilli--tiscalinet--it]> writes:

 [11/13] from: g:santilli:tiscalinet:it at: 17-Oct-2001 15:09


[Robbo1Mark--aol--com] wrote:
> But you can never get UNSET returned as the result of > an expression ie > > == unset
Following your reasoning, I could argue that you can never get an object! as the result of an expression. Indeed, the REBOL console does not show OBJECT! values when they are returned. In the same way, it does not show UNSET! values when tahy are returned. BUT they ARE returned! HTH, Gabriele. -- Gabriele Santilli <[giesse--writeme--com]> - Amigan - REBOL programmer Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

 [12/13] from: robbo1mark:aol at: 17-Oct-2001 9:44


Gabrielle, I never said they weren't RETURNed rather DO does NOT print them as a result, as you rightly also point out is the same as contexts / object! types. ie we dont get a printed result == unset In these circumstances we system/console propmt instead ie
>> *** FLASHING CURSOR ***
This all began in relation to Ladislav's recent essay about interpretation, that's all. Mark In a message dated Wed, 17 Oct 2001 9:25:33 AM Eastern Daylight Time, Gabriele Santilli <[g--santilli--tiscalinet--it]> writes:

 [13/13] from: lmecir:mbox:vol:cz at: 17-Oct-2001 16:26


Hi, just a side note. You can see what is going on in these cases:
>> trace on >> print 1
Trace: print (word) Trace: 1 (integer) 1 Result: (unset)
>> make object! []
Trace: make (word) Trace: object! (word) Trace: [] (block) Result: (object) Cheers Ladislav