Pgagmas (was Re: Small poll)
Joe Armstrong
joe@REDACTED
Thu Dec 11 10:09:44 CET 2003
Well ...
a + 42
IS legal code, it might be part of a test suit to test that the
run-time exception handling stuff works.
We need pragmas :-)
a + 42 generates a hard compiler error (not like to today)
and refuses to compile ie your (3)
PRAGMA deliberate_error
a + 42
END
works like (1)
This is what I called "intentionality" in my thesis :-) - the thing is
you don't know why the programmer wrote 42+a - there are two cases
a) The programmer knew it was an error, or,
b) It was an error
Adding a pragma allows the best of both worlds, :-)
/DrJoe :-)
On Wed, 10 Dec 2003, Kostis Sagonas wrote:
> I was wondering whether the Erlang user community would care
> to comment on the following:
>
> In a function like:
>
> test(A) ->
> a + 42.
>
> which is either crap (arguably) or a typo (A vs a), how many
> Erlang users:
>
> 1. Are content with the current situation where the compiler
> happily compiles this program
> 2. Would like to see a warning, but a .beam file generated
> nevetheless
> 3. Would prefer if the compiler in R10 refused to compile it
>
> Notice I am not talking about any serious attempt to static
> type checking, but for really "basic" checks.
>
> Kostis.
>
More information about the erlang-questions
mailing list