[erlang-questions] Here's hoping we get frames or structs in 2009!
Alex Arnon
alex.arnon@REDACTED
Mon Jan 12 13:29:06 CET 2009
+1
May 2009 be the Year of the Lightweight Hash :)
On Mon, Jan 12, 2009 at 1:10 AM, James Hague <james.hague@REDACTED> wrote:
> I've been using Erlang as my primary language for personal projects
> for some years now, though I also use and enjoy Perl, Python, REBOL,
> C++, Lua, and occasionally Forth. Quite often I'm surprised at how
> much easier it is write certain types of code in Erlang...and I'm also
> surprised at how awkward it is to write other types of code in Erlang.
> Sometimes the awkwardness is because I just can't think of a pretty
> way to avoid destructive updates in an algorithm that's inherently
> destructive. But much of the time it's from working around the lack
> of lightweight dictionaries or hashes.
>
> In Perl, I don't think twice about creating hashes:
>
> (width => 1280, height => 1024, colors=655536)
>
> The Python version is similarly clean:
>
> dict(width=1280, height=1024, colors=65536)
>
> In Erlang, I can create a property list:
>
> [{width,1280}, {height,1024}, {colors,65536}]
>
> which isn't bad in itself, but not being able to pattern match on
> these is what hurts.I work around it by manually grabbing properties,
> but the code ends up bulky and contrived. Yeah, we've all discussed
> this for years, so here's hoping there's some movement on this front.
> Syntactically, the version I like the most at the moment is the record
> syntax without a record name:
>
> #{width=1280, height=1024, colors=65536}
>
> James
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090112/b54543bf/attachment.htm>
More information about the erlang-questions
mailing list