[erlang-questions] Re: Process Dictionary vs Proplist in Web Frameworks

Dan Gudmundsson dangud@REDACTED
Fri Oct 30 08:14:45 CET 2009


On Fri, Oct 30, 2009 at 1:34 AM, Geoff Cant <nem@REDACTED> wrote:
>
> In the case of 'wx', the process dictionary is used to pass around a
> #wx_env{} structure - I'm not quite sure why this wasn't just a
> parameter instead. Maybe there's something else (like port ownership?)
> that makes tying the structure to the process in the process dict make
> sense? I'm kinda curious about this one - if there's a good argument to
> be made for using the process dictionary, I'll amend or retract my
> anti-process-dictionary bigotry :)

My argument for having the 'env' in the process dictionary was that it
is static,
and that most of the calls in wx are prefixed with an 'TheObject' as
well, so I didn't
want the user to keep sending both the 'env' and 'This' in all calls,
wxFrame:setTitle(Env, TheObject, "My window Title"),
vs C++
TheObject->setTiltle("My Window Title"),

I could have put the 'env' in each object reference, but that would
have increased every
object reference in erlang with two words, also for static calls which
don't work on an
object I would then have to add an 'env' parameter, which isn't there
in the C++ lib.

/Dan

>
> Cheers,
> --
> Geoff Cant
>
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>


More information about the erlang-questions mailing list