[erlang-questions] Frames proposal
Wed May 2 01:01:56 CEST 2012
On 2/05/2012, at 2:28 AM, Max Bourinov wrote:
> Hi Richard,
> Thank you very much for posting your great work!
> But the title scared me. "Getting rid of records" - what should I do with all my code that uses records?
> I like the idea of frames a lot. It would significantly simplify my code and I love this idea.
There are several answers to 'what should I do'.
(1) If it ain't broke, don't fix it.
Records are NOT going to go away.
There's an analogy from Fortran. Fortran 66 had so-called
'Hollerith literals', where you would write e.g., 4HFRED
to get a string "FRED". That's right, the length as a
decimal integer, the letter capital H, and then that many
characters. With the advent of proper character data in
Fortran 77, Hollerith literals were not needed any more.
They had always been clumsy and error-prone. But they
stayed. I can't remember if they were still there in
Fortran 90 or not, but by Fortran 95 they were gone.
Well, I just tried a Hollerith literal in a tiny program
and while the Fortran 95 compiler *complained*, the
The Erlang community isn't quite _that_ committed to
backwards compatibility, but it's not too far off...
(2) Frames are almost drop-in replacements for records.
The major exception is default initial values for fields,
which have problems anyway.
Years ago I wrote a paper 'Delenda est preprocessor'.
Abstract patterns and frames are all part of a long-time
project to make the preprocessor unnecessary.
But, sigh, it will probably never go away.
More information about the erlang-questions