Language change proposal

Chris Pressey cpressey@REDACTED
Fri Oct 24 18:53:21 CEST 2003


On Fri, 24 Oct 2003 15:42:49 +1300 (NZDT)
"Richard A. O'Keefe" <ok@REDACTED> wrote:

> Chris Pressey <cpressey@REDACTED> suggested:
> 	It's a good idea, but wouldn't it be easier to write code that
> 	works on different versions if it was done with macros,  e.g.
> 	
> 	  -ifdef(?ERLANG_5_3).
> 	[snip]
> 	  -endif.
> 	
> 	I think this would be the way to go if you wanted to write code
> 	that takes advantage of new features while still being able to
> 	compile and run on older installations.
> 	
> AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARGH!

Gee Richard A. O'Keefe, you sound a bit stressed.  Maybe you should make
yourself a nice hot cup of peppermint tea and re-read my "suggestion"
(as you call it) paying closer attention to how I used the word "if".

> Someone please tell me this was a late April Fools' joke?

Let me put it this way: if it's easy to tell when I'm being serious and
when I'm not, I'm not doing my job.  I AM a Bishop, after all.

> If would be nice if people finally understood why the Ada requirements
> explicitly required that there *NOT* be a preprocessor or conditional
> compilation facility...

Yes, it would be nice.  I think I've done my part by understanding it
fairly well.  However, I'm also not very optimistic about seeing
invariant expressions in Erlang any time soon.

Ah, but the rivers of the Erlang support list are choked with the bodies
of keyboard-pounding language designers, are they not?   Guardians of
Truth and Beauty, each and every one of us, who do not seem to realize
that Erlang is not a project in pursuit of perfect language purity.  It
is, in fact, an exercise in return-on-investment (right, Mr. Ericsson?)

And defining a new predefined macro is just about as small an investment
there is.

Take it one small step further and add -assert() to -ifdef() and
friends, and I for one have a hard time explaining the difference
between

  -requires_erlang('5.3').

and

  -assert(?ERLANG_VERSION, '5.3').

in terms that the average non-language-designing Erlang programmer would
appreciate or care about.  So it would seem to me that this small
investment gets a comparable return.  Perhaps even a greater one, when
you consider the same -assert() mechanism can be used for any other
macro already in use, predefined (like ?MACHINE) or otherwise.

So there you have a plausible case for using macros.

Of course, if you think that just because I can make that case means
that that's the way I truly feel, you're a bigger sucker than I thought.

-Chris



More information about the erlang-questions mailing list