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

[REBOL] Re: Help me, Obi Reb Kenobi, you're my only hope!

From: lmecir:mbox:vol:cz at: 1-Sep-2002 13:23

Hi Gabriele and all, LM> I am still curious, if many Rebol users prefer to allow UNSET! valued LM> expressions (eventually why?). <<Gabriele>> There's no reason to have them, and that's just likely to be an implementation issue with the current interpreter (it needs unset! for unset words, and once you have that is pretty natural to have:
>> f: func [] [return]
return unset!, being RETURN's argument unset; so they have probably decided that empty blocks should have returned unset! too...) <</Gabriele>> <<L>> You are right, it looks logical at a first glance. Nevertheless, the following looks logical too: type? while [false] [] ; == none! and it differs from type? do [] ; == unset! I think, that the behaviour should be unified. My proposition is to use the former convention, which is much less complicated. I am not against using UNSET! values internally for the interpreter purposes (detection of uninitialized variables). OTOH, this purpose is totally internal and shouldn't be "exposed" to the user. A similar "quirk" with an END! type value has already been straightened by RT. <</L>> LM> OTOH, both versions of DEFAULT cannot discern "illegal" and "legal" errors, LM> which is another quirk in Rebol I would prefer to have straightened. <<Gabriele>> I was looking in your site to see what you intend for an illegal error, but I wasn't able to find it. <</Gabriele>> <<L>> It is my fault, I wrote it too lazily. Here is a more thorough explanation: block: [] probe disarm try [first block] ; == make object! [ ; code: 315 ; type: 'script ; id: 'past-end ; arg1: none ; arg2: none ; arg3: none ; near: [first block] ; where: none ; ] The result of the (first block) expression evaluation doesn't exist in a sense. Try "creates" its result catching the fired error you see above. Now a more complicated code sample: block2: head insert tail copy [] try [first block] probe disarm try [first block2] The difference is, that in this case the result of the (first block2) expression evaluation "legally" exists, that is why I call it a "legal" error. A function like TRY cannot discern these cases, while a native version of the DEFAULT function could. Ciao -L