Wither Self (shortish)

Chris Pressey cpressey@REDACTED
Thu Sep 11 19:50:47 CEST 2003


On Thu, 11 Sep 2003 15:23:42 +0300 (EEST)
Taavi Talvik <taavi@REDACTED> wrote:

> What about:
> 
> 	button_pressed(button_ID, [ListOfEventOptions],
> 	[ListOfUserParameters])
> 
> 	where
> 	ListOfEventOptions = [{parent_window, WinId}, {key,value},...]
> 	ListOfUserParameters = [{key,value},...]
> 
> this does not work for legacy code, but for general framework it is
> clear win.

Yes, that's especially good for interfaces - but again, it really
doesn't help this situation, because I'd have to encode the options list
and decode it again (with lists:keysearch/3, or proplists I suppose,)
and it's still two places in the source I have to change if something
changes, as opposed to zero.  And this way, the places are even larger.

Basically, defining my callbacks as funs within a main function is the
syntactically lightest choice for this task.  The only real drawbacks
are indentation, as Luke mentioned - and I use a conservative indenting
policy, so that's essentially not a problem for me - and the size of the
main function, which is easily mitigated by a folding editor like SciTE.

-Chris



More information about the erlang-questions mailing list