Emscripten code style

20 views
Skip to first unread message

David LaPalomento

unread,
Dec 1, 2010, 9:45:47 PM12/1/10
to emscripte...@googlegroups.com, llvm-js...@googlegroups.com
I've started looking into the Emscripten codebase to see what would be
necessary to make modifications to the internal data format. I haven't
had much trouble tracking down what I'm looking for but I did have a
couple questions. First, enzymatic.js makes reference to an enzymatic
programming paradigm-- I'm not familiar with this term and the top
Google results seem to be coming out of biology. Do you have a link to
any background info? Also, I noted a number of object literals have
trailing commas. This is not often a problem in practice but I do
think it's cleaner to omit them. Would a patch that removed them be
welcome?

David

Alon Zakai

unread,
Dec 2, 2010, 9:08:15 PM12/2/10
to llvm-js...@googlegroups.com, emscripte...@googlegroups.com
> I've started looking into the Emscripten codebase to see what would be
> necessary to make modifications to the internal data format. I haven't
> had much trouble tracking down what I'm looking for but I did have a
> couple questions. First, enzymatic.js makes reference to an enzymatic
> programming paradigm-- I'm not familiar with this term and the top
> Google results seem to be coming out of biology. Do you have a link to
> any background info?

That stuff was an experiment I did as I coded
Emscripten. I'm still not sure if it was useful
or not ;)

Basically, all it is is the idea that there are
'items' that are processed, and 'processors'
that process them. Each processor processes
some items, then transfers them to other
processors (or marks them as final results).

What's useful in the approach is that it
is easy to debug (get printouts about what
processors run and on what), and could be
scaled to multiple threads very easily. It
also leads to very modular code. But, it's
also clunky sometimes.

> Also, I noted a number of object literals have
> trailing commas. This is not often a problem in practice but I do
> think it's cleaner to omit them. Would a patch that removed them be
> welcome?
>

Sure!

- azakai

David LaPalomento

unread,
Dec 3, 2010, 12:20:43 AM12/3/10
to llvm-js...@googlegroups.com, emscripte...@googlegroups.com
Attached is a diff that removes trailing commas in literals and adds
the optional semi-colons to expressions that didn't have them. Thanks
for the background on enzymatic, hopefully I'll be able to transform
that knowledge into some working code soon.

David

formatting-cleanup.diff

Alon Zakai

unread,
Dec 10, 2010, 1:45:07 AM12/10/10
to llvm-js...@googlegroups.com, emscripte...@googlegroups.com
(Sorry for not getting to this sooner, been very busy...)

Thanks for the patch! I'm applying all of it but the
part with adding semicolons inside one-line
lambda functions. I prefer it without semicolons
in that case, they look more like lambdas that way
IMO.

- azakai

David LaPalomento

unread,
Dec 11, 2010, 3:48:38 PM12/11/10
to llvm-js...@googlegroups.com, emscripte...@googlegroups.com


On Dec 10, 2010 1:45 AM, "Alon Zakai" <aza...@mozilla.com> wrote:
>
> (Sorry for not getting to this sooner, been very busy...)
>

Not a problem, I know how that goes.

> Thanks for the patch! I'm applying all of it but the
> part with adding semicolons inside one-line
> lambda functions. I prefer it without semicolons
> in that case, they look more like lambdas that way
> IMO.

Sounds reasonable to me. Also, I have been playing with runner.py so that you can source the config params from ~/.emscripten or your environment rather than having to edit the source tree itself as part of my general effort to get all the tests passing after modifying the parser. Is that interesting?

David

Alon Zakai

unread,
Dec 11, 2010, 5:20:33 PM12/11/10
to llvm-js...@googlegroups.com, emscripte...@googlegroups.com
> ----- Original Message -----
> From: "David LaPalomento" <dlapal...@gmail.com>
> To: llvm-js...@googlegroups.com
> Cc: emscripte...@googlegroups.com
> Sent: Saturday, December 11, 2010 12:48:38 PM
> Subject: Re: Emscripten code style
> On Dec 10, 2010 1:45 AM, "Alon Zakai" < aza...@mozilla.com > wrote:
>
> I have been playing with runner.py so
> that you can source the config params from ~/.emscripten or your
> environment rather than having to edit the source tree itself as part
> of my general effort to get all the tests passing after modifying the
> parser. Is that interesting?
>

Definitely! I've been meaning to do that for
a while, but haven't gotten around to it.

- azakai

Reply all
Reply to author
Forward
0 new messages