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

[REBOL] Re: How do I handle an unset! item as a parameter to other words

From: jan:skibinski:sympatico:ca at: 2-Dec-2002 10:06

Hi Gerard,
> I looked for something like using the following constructs but I got a > similar error in any case : > > >>write %rebol-dict-2.txt what > ... a long list of the avail. words and their args follows then ... > ** Script Error: write is missing its value argument > ** Where: halt-view > ** Near: write %rebol-dict-2.txt what > >> >
That's the expected behaviour. Function 'what accepts nothing and returns nothing. In C or Java parlance it's return type would be 'void. It does print something on the console, but that's a side effecting operation. Other (static!) languages would spell it very clearly: Ocaml ------ what: ( ) Haskell ----- what :: IO ( ) but unfortunately Rebol does not care that much for the return types, because it can only figure them out dynamicly; that is, after executing statements or expressions. That's what the 'type? function is telling you: type? what == unset It means that there is no real object returned from the 'what function. If you want to intercept output from functions like this then you need to deal with the standard output itself. Look at the script library - consoleio.r, keyb.r, etc. Regards, Jan