Is there some common / best way for coding builders?

Two ways that I see are:

a) using a block - I've seen this in menus and some other, however in my
case I need to add an extra parameter as label

"variant with two params"
aForm addDropList: 'Type' with: [ :dropList |
dropList
items: #(input #output);
" ... ".
].

"variant with one method param and value holder"
aForm addDropList: [ :labelHolder :dropList |
labelHolder value: 'Type'.
dropList
items: #(input #output);
" ... ".
].

b) using return value - no blocks, no extra code
(aForm addDropList: 'Type')
items: #(input #output);
" ... ".

I would use the second variant as it looks much cleaner, however
considering how widespread is the use of the first variant I think I must
be missing something.

Thanks,
Peter

Reply via email to