[erlang-questions] Why can't you have a variable before a string with pattern matching?

Javier París javierparis@REDACTED
Thu May 31 21:18:37 CEST 2007

El Thursday 31 May 2007 19:37:14 Jordan Wilberding escribió:
> Hello,
> I was just wondering why having
> fcn("text" ++ String) -> ..
> is legal, but doing
> fcn(String ++ "text")
> is not legal. Is this for performance reasons, or something else?

This is an speculation, but it's probably because it's easy for the compiler 
to see that the first pattern is time-bounded, while the second is not 
(because it depends on the lenght of the string).


Javier París

More information about the erlang-questions mailing list