[erlang-questions] Return value: optimization?
Roberto Ostinelli
roberto@REDACTED
Sun Feb 1 16:46:37 CET 2015
There you go ^^_
Thanks,
r.
On Sun, Feb 1, 2015 at 4:37 PM, Loïc Hoguin <essen@REDACTED> wrote:
> It's to inform Dialyzer that yes, we really do want to ignore the returned
> value. Should have no impact on execution otherwise.
>
>
> On 02/01/2015 04:12 PM, Roberto Ostinelli wrote:
>
>> Dear list,
>> I was going through cowboy's code and I keep on seeing patterns such as
>> this:
>>
>> _ = cowboy_req:reply(Status, Req), [1]
>>
>> or this one:
>>
>> _ = case TRef of
>> undefined -> ignore;
>> TRef -> erlang:cancel_timer(TRef)
>> end, [2]
>>
>> All of these are done when we're there's no tail recursion. So now I'm
>> curious: what is the purpose of explicitly assigning an anonymous
>> variable to these expressions? Is this some kind of memory optimisation
>> I'm just now aware of?
>>
>> Best,
>> r.
>>
>>
>> [1]
>> https://github.com/ninenines/cowboy/blob/1.0.1/src/cowboy_
>> protocol.erl#L504
>> [2]
>> https://github.com/ninenines/cowboy/blob/1.0.1/src/cowboy_
>> handler.erl#L274
>>
>>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
> --
> Loïc Hoguin
> http://ninenines.eu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150201/ebf080bd/attachment.htm>
More information about the erlang-questions
mailing list