some questions (was Re: illegal guard)

Bob Smart Bob.Smart@REDACTED
Thu Feb 17 01:12:22 CET 2000

 > One of the reasons for this is that guards
 > should be easy to implement and very fast to check

I can understand this in receive, but do all guards have to be so restricted?
For example it makes "if" prety useless. Mind you I worked out that you
should use "case <boolean-expression> of ..." instead of "if". However
that brings up another problem:

Why do some things, like atom(X), only work inside guards and don't
give boolean results elsewhere. This is a minor irritation when writing
filter functions.

2. Erlang 5?

I saw a reference to Erlang 5 (in the mercury users mailing list).
Where is this being discussed? I have a few suggestions: not just on
booleans and guards.

3. JVM?

I saw a claim that the JVM doesn't handle tail recursion well so
would be problematic for functional languages. Not sure where I saw 
this but on reflection I don't understand it. All you have to do
(in Java rather than JVM terminology) is wrap the function body in
"while(true) { ... }". When you want to do a tail recursion you just
do (as you would at machine level): change the parameter and "continue".
Obviously you have to exit such a routine with an explict "return val".
Am I missing something?


More information about the erlang-questions mailing list