[erlang-questions] String continuation
Alexey Romanov
alexey.v.romanov@REDACTED
Thu Jan 13 22:17:48 CET 2011
++ _between string literals_ is slow? I'd expect it to be optimized by
the compiler just like "str1" "str2" is.
Yours, Alexey Romanov
On Thu, Jan 13, 2011 at 9:07 PM, Evgeniy Khramtsov <xramtsov@REDACTED> wrote:
> 14.01.2011 02:40, Attila Rajmund Nohl wrote:
>>
>> Hello!
>>
>> Let's have a look at this little example code:
>>
>> -module('strc').
>>
>> -export([f/0]).
>>
>> f() ->
>> {["string1",
>> "string2"],
>> ["string3"
>> "string4"]}.
>>
>> This compiles fine and returns a tuple with two lists, the first with
>> 2 strings, the second with a single list. Of course, if there was only
>> a typo in the second list (a missed comma), I wouldn't notice it until
>> the code executes (which might happen in an inconvenient time in error
>> handling code). I wonder that the possibility to omit the extra ++
>> from the end of "string3" line worth the problems what might be caused
>> by the missing comma. This only bit me once, so it might not be that
>> common...
>>
>
> ++ operator is slow. It is better to use dialyzer in order to track such
> errors.
>
> --
> Regards,
> Evgeniy Khramtsov, ProcessOne.
> xmpp:xram@REDACTED
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>
More information about the erlang-questions
mailing list