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

simple view question

 [1/2] from: rishioswal::yahoo::com at: 9-Apr-2001 23:42


why is it that code in layout can use some rebol code without parenthesis. For example, you can use the function 'read in a layout block as shown below. In addition, why can some functions be used and others cannot...ei. you can't use the function 'print directly in layout. why this: view layout [text read %file.txt] and not this: view layout [ text "hello" print "how do you do" ]

 [2/2] from: brett:codeconscious at: 10-Apr-2001 17:19


First thing to say is that the layout function takes the VID dialect as input. A dialect follows a syntax that may be different from "normal" rebol code. The short answer is VID doesn't handle the print function because print does not return a value that VID expects. Going back to why the first example works. Well, read %file.txt returns a string and VID can use strings. Probe returns a value - the value that it was given so this works: view layout [ text "hello" probe "how do you do" ] and so does this view layout [ text probe "how do you do" ] and so does this bizarre-function: does [ for i 1 5 1 [print i] "bizarre function result"] view layout [ text bizarre-function ] Also note that VID allows a single (once only) evaluation of an arbtrary expression using the word do Like this: view layout [ text "hello" do [print "how do you do"] ] I hope that helps. Maybe someone else can put it more succinctly. Regards, Brett.