[erlang-questions] Frames proposal

Richard O'Keefe <>
Wed May 2 02:22:57 CEST 2012


On 2/05/2012, at 3:48 AM, Juan Jose Comellas wrote:

> And what about borrowing the syntax that Anton Lavrik used for erlson [1]? That syntax looks similar to the one used for records and is much easier to read/write.

The frames proposal was written long before erlson was a twinkle in its author's
eye.  Indeed, it was originally drafted in the year that JSON was invented (2001),
so JSON was not an influence.

The frames proposal explains why using '=' in maplets is a bad idea.
Basically, it is HARDER to read because it makes '=' locally ambiguous.
You go searching through a file and hit the line

	foo = bar(),

and you have NO IDEA whether this is a maplet or a matching.  BAD!

As for #{...} vs <{...}>, it's in one way harder to write
(to get <{, press SHIFT with left hand, and then < and { are close
for two-fingered right hand typing; the same is true of }>,
but #{ requires me to hold down the shift key with my left hand
AND press the # key with my left hand at the same time, and while
there is a shift key on the right, { requires the use of the right
hand).  Brackets really ought to be mirror symmetric, but I could
live with #{...}.

There's a section in the proposal titled
"The Colour of the paint on the Ark."
	why do we find it easier to argue about the colour
	of the paint on the Ark than to climb aboard?
That is the section that provides the reasons for the syntax.

Now Jan Burse and I have been arguing with each other about frames,
but actually, that was a *lot* more useful, because he focussed on
semantics.

But here's the most important thing, which appears in the next draft
of the frames proposal:

	This would have been a workable syntax for frames
	before erlson used it.  Now, it is important that the syntax
	should be distinct from erlson syntax, so that frames can be
	added to Erlang without breaking erlson.  There is also an
	important pragmatic difference between frames and erlson.
	Frames are new built in data type with a good deal of thought
	put into making them economical in memory and time.
	``At runtime,  Erlson dictionaries are represented as a list
	of {Name, Value} tuples ordered by Name.  This way, each Erlson
	dictionary is a valid proplist  and orddict in terms of the
	correspond[ing] stdlib  modules.''  
	An entry in an Erlson dictionary thus takes 4 words for the
	{Name,Value} tuple plus 2 words for the list cell pointing to
	it, or 6 words compared with a frame's 1 or 2.
	It therefore matters which one you are using: a programmer
	needs to be able to tell at a glance whether an expression
	deals with a frame or with an erlson dictionary.

That is, we shouldn't copy Erlson syntax, BECAUSE Erlson IS ALREADY
USING IT and we must not break Erlson.




More information about the erlang-questions mailing list