A Pythonista's Impressions of Erlang
Wed Jan 12 15:29:53 CET 2005
> To do it this way involves a quick hack to the
> of a rather simple parse_transform to change the
> semantics of
> the compiler.
> Actually I see no reason why patterns like Var ++
> StringLiteral should not
> be compiled, especially since StringLiteral ++ Var
> *is* allowed - and therefore
> disallowing Var ++ StringLiteral violates the
> principle of least astonishment.
X ++ "string" would compile into string searching
(linear time), rather than pattern matching (constant
There might be multiple matches, what to do about
those? (May I suggest backtracking? :-)
What about nested patterns, e.g.,
"foo:" ++ X ++ "=" ++ Y?
Will your simple parse transform really be all that
simple once we consider all the cases? (Perhaps the
best solution is to write it and see.)
However, I'll agree that more generally it might be
nice to have some sort of regexp patterns, especially
when doing the string processing tasks that tend to
pop up. (Parsing text based protocols, say?)
Also, regexps/string operations on binaries might be
more familar to people used to "strings as arrays".
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
More information about the erlang-questions