Compiler bug

Hakan Stenholm <>
Fri Apr 12 14:41:56 CEST 2002


> To: Hakan Stenholm <>
> Cc: , 
> Subject: Re: Compiler bug
> From: Bjorn Gustavsson <>
> Date: 12 Apr 2002 14:10:52 +0200
> 
> The example is legal Erlang code.
> 
> is_list/1 is a type check (from R8). "and", "or", and "not" are now allowed
> (from R8).

Is there a up to date version of the guard expression description ?
Page 29-30 (Concurrent programming in erlang 2:nd edtion) lists most typechecks, 
comparision and bifs allowed.
Erlang Extensions Since 4.4 (html docs) mentions the record/2 and function/1 
typecheck, but where is is_list/1 and the use of "and", "or", and "not" 
mentioned ?

> 
> There really is a bug in the compiler.
> 
> A bug fix will probably be included in the next OS release of R8B.
> 
> /Bjorn
> 
> Hakan Stenholm <> writes:
> 
> > >I found a compiler bug in R8B-0.  Here is the simplest test case
> > >I could come up with:
> > >
> > >-module(compiler_bug).
> > >-export([test/1]).
> > >
> > >test(A) when not is_list(A) -> A.
> > 
> > This shouldn't work:
> > * you can't use user defined functions (like is_list/1) in a guard, 
> >   only type checks: 
> >   atom/1, constant/1 ,float/1, integer/1, list/1, number/1, pid/1, 
> >   port/1, reference/1, tuple/1, binary/1, record/2
> >   
> >   comparision operartors: 
> >   >,<,=<,>=,==,/=,=:=,=/=
> >   
> >   and some bifs (together with arithmeteric ops): 
> >   element/2, float/1, hd/1, length/1, round/1, self/0, size/1,
> >   trunc/1, tl/1, abs/1, node/1, node/0, nodes/0
> >   
> > * I'm not sure if "and", "or" and "not" can be used (, and ; can be used in 
a 
> >   when statement to get "and" and "or" behaviour).  
> > 
> 
> -- 
> Björn Gustavsson            Ericsson Utvecklings AB
>       ÄT2/UAB/F/P
> 			    BOX 1505
> +46 8 727 56 87 	    125 25 Älvsjö




More information about the erlang-questions mailing list