* Ladislav Mecir <[EMAIL PROTECTED]> [050731 02:18]:
> >            code: load rejoin["append output do-" type " name layout"]
> >            ?? code   ;; see code "dump" below
> >            do code
> >        ]
> >    ]
> >  
> >
> ...snip...
> 
> that load rejoin [...] is a "beginner's gotcha" described in the doc. It 
> brings more problems that it can solve. Don't use "command strings" when 
> you don't have to, always use blocks - it is faster, safer and simpler. 
> What about this one?
 
  Hi Ladislav:
  
  Boy am I behind in docs! What I have doesn't have any gotchas. 
  Can you point me to those docs?

> type-handler: make object! [
>     button: func [name layout] [print "this is do-button" 'do-button]
>     checkbox: func [name layout] [print "this is do-checkbox" 'do-checkbox]
>     time: func [name layout] [print "this is do-time" 'do-time]
>     hidden: func [name layout] [print "this is do-hidden" 'do-hidden]
>     radio: func [name layout] [print "this is do-radio" 'do-radio]

 That's almost pythonistic in it's engineering (from me that's a
 complement) :-). However, if I understand you correctly, it would
 be as large and repetitive as the original switch.

> output: copy []
> foreach plist glbs/plists [
>     foreach [name layout] plist [
>        type: in type-handler to word! select layout "type"
>        append output do type name layout

   I would upon recoding, place all type handlers in a context with
   the same name as the type.

   ;Then replace
        append output do type name layout
        ;; with
        append output type-handler/:type name layout

   Or even create a 'name and 'layout member for the type-handler
   context - to cut down on the interface specs for the methods.
 For the time being, the solution was to use 

 do compose[append output (to-word join "do-" type) name layout]]
 ;; but a formal type-handler context is more professional, methinks

 Regards
 tim

-- 
Tim Johnson <[EMAIL PROTECTED]>
      http://www.alaska-internet-solutions.com
-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to