Hi Tim,

Your code below seems to be generating code using a macro.
It seems extremely unwieldy to me and needs a clever
bit of rebol to shrink it to its essence.

What are the changing parts (what value and type are they) ?

It looks to me like the changing parts are:

        - widget style 
        - widget feel

where the feel is just used to detect different key presses (?)

I would love to know the intention of your code so we
can refactor it.

Anton.

> # Example: explicit
>  def do_sql(name,layout):
>       dispatch = {
>           'radio':kbLists.do_sql_radio(),
>           'text':kbLists.do_sql_text(),
>           'textarea':kbLists.do_sql_textarea(),
>           'decimal':kbLists.do_sql_decimal(),
>           'uinteger':kbLists.do_sql_uinteger(),
>           'select':kbLists.do_sql_select(),
>           'date':kbLists.do_sql_date(),
>           'checkbox':kbLists.do_sql_checkbox(),
>           'password':kbLists.do_sql_text(),
>           }
>       return '  %s %s,' % (name,dispatch[layout['type']])
> # Example: using builtin _dict_ in class constructor      
>     def __init__(self, url='', text='', **kw):
>         self.target = None
>         self.onClick = None
>         self.onMouseOver = None
>         self.onMouseOut = None
>         self.url = url
>         self.text = text
>         # target ... text constitutue self.__dict__ when they are
>         # preceded by 'self.'
>         for item in kw.keys():
>             if self.__dict__.has_key(item):
>                 self.__dict__[item] = kw[item]
>             else:
>                 raise KeyError, `item`+' not a valid parameter 
> for this class.'

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to