[erlang-bugs] bug

Kostis Sagonas kostis@REDACTED
Wed Jan 5 15:55:17 CET 2011


Joe Armstrong wrote:
> -module(ecc_pass1).
> 
> 
> -record('FUNCTION',
> 	{
> 	  compound_statement   %% function body
> 	 }).
> 
> -export([start/2]).
> 
> %% returns #Pass1 or throws an error
> 
> start(File, ParseTree) ->
>     Fs = [I || I <- ParseTree, is_function(I)].
> 
> is_function(X) -> is_record(X, 'FUNCTION').
> 
> 
> Compiling this crashes the compiler

The compiler should of course not crash, but is it a good idea to
have a function whose name clashes with the name of a built-in guard?

Rename is_function to something else (e.g. my_is_function) and the 
problem will go away.

Kostis


More information about the erlang-bugs mailing list