Wed Dec 17 10:32:18 CET 2003
Robert Virding wrote:
> It is a perfectly legal expression but when evaluated it generates an error. As errors are a part of Erlangs semantics you can't go and just eliminate any expression which might generate one.
may i continue to respectfully belive that code that will _always_
generate an error should stop the compilation?
>A compiler should disallow illegal code, do its best with legal code
and try to be helpful by warning about legal, but potentially confusing
or with misleading results, code or constructions.
this is something i can fully agree with. i just happen to think that
''do its best'' in the case of only ''a+42'' is to not compile it.
> Well, it's pretty obvious that if you write something like a+42 in your code then you're intending it to fail. I mean there are limits. :-) I usually document code which is not plainly obvious and which I feel I might have difficulty remembering what it did at a later date, or does something tricky and smart. This and a comment at the beginning of the function usually suffices. I am of the opinion that having to many comments tends to make everything difficult to read. Also having a comment standard helps to keep comments short. Read through the compiler and parts of the libraries (the more basic ones) to see how I code.
you are much to kind to me. if i write ''a+42'' it is because i am
making a stupid mistake, nothing else. probably i intended it to be
your comment standard seems very good. i hope that i am using it (or
i am aware of the benefits i can draw from reading more code. actually,
that would be from reading more code written by somebody better than me
(at writing code, ofcourse). but this is always the case in the basic
erlang libraries. still, when time permits some thing like that, i
ususally write some code instead. stupid behaviour.
More information about the erlang-questions