[erlang-questions] erlang sucks
Mats Cronqvist
mats.cronqvist@REDACTED
Tue Mar 18 09:25:45 CET 2008
Kevin Scaldeferri wrote:
> On Mar 17, 2008, at 6:31 AM, Jani Hakala wrote:
>
>
>> attila.rajmund.nohl@REDACTED writes:
>>
>>
>>> I don't think that immutable variables make it easier to write less
>>> buggier code. On the contrary, I often see code like this:
>>>
>>> HR1=f(HugeRecord),
>>> ...
>>> g(HR1).
>>>
>>> Then someone adds a line to modify the HugeRecord and forgets to
>>> update
>>> the call to 'g':
>>>
>>> HR1=f(HugeRecord),
>>> HR2=f2(HR1),
>>> ...
>>> g(HR1).
>>>
>>> Now we have a stupid bug.
>>>
>>>
>> The compiler would warn about that
>> Warning: variable 'HR2' is unused
>>
>
>
> These examples always feel like people are insisting on writing
> imperative code in a functional language. Why not:
>
> HR1 = f2(f(HugeRecord)),
> ...
> g(HR1)
word. i too tried to get erlc to compile thinly disguised C code when
i first learned erlang.
mats
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mats_cronqvist.vcf
Type: text/x-vcard
Size: 179 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080318/df496243/attachment.vcf>
More information about the erlang-questions
mailing list