Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What causes a misplaced item error in rebol?

Here is the code pruned down to a minimum to show the error:

Rebol []

view center-face layout [
    fld1: field
    fld2: field
    flds: [fld1 fld2]
]
like image 364
johnorork Avatar asked Oct 21 '22 11:10

johnorork


1 Answers

Here is the shortest example to show the error:

layout [ test: []] 
>>Misplaced item: []

Rebol uses a number of different dialects, and the two you are using in this example are the do dialect and the view dialect. Now inside the 'layout function, you can only have the view dialect but you have mixed the two. So, the parser used by the 'layout function complains of the misplaced item. The dialect expects to see after flds: one of the faces such as field, area, label etc but instead finds a block.

Regarding your clarification comment, if you wish to create a block of fields, you can just create the block first and then provide it to the 'layout function like this so that you end up with fields named var1 to var9.

lo: [ across ]

for i 1 9 1 [
    repend lo [ 'label  form join "var" i to set-word! join "var" i 'field 'return ]   
]

view layout lo
like image 145
Graham Chiu Avatar answered Dec 28 '22 01:12

Graham Chiu