Good practice

Lennart Öhman lennart.ohman@REDACTED
Fri Jul 18 21:21:05 CEST 2003


Hi, one might think so. But not every one considers a case
statement to be a scope of its own. Anyway *a lot* of
now existing code if programmed the way demonstrated below
making changing it completely out of question. If I am not
mistaken presenting a warning was a compromise introduced
some years ago.

/Lennart

Chris Pressey wrote:
> On Sun, 8 Jun 2003 17:28:01 -0400 (EDT)
> erlang@REDACTED wrote:
> 
> 
>>bash$ erl
>>Erlang (JAM) emulator version 47.4.1
>>
>>Eshell V47.4.1  (abort with ^G)
>>1> c(test1file).
>>./test1file.erl:172: Warning: variable 'Response' exported from
>>['case']{ok,test1file}
>>2>    
>>
>>
>>From the file in question:
>>
>>      case checkvalid(Funcref, Correctlist) of
>>        false ->
>>          Response = false;
>>        Other ->
>>          Response = invoker(Other, Otherargs)
>>      end,
>>      Requester ! Response,  
> 
> 
> I've never actually understood why this isn't a full-fledged error.
> 
> Is there a good reason that bindings are allowed to 'leak' out of a
> case..end?
> 
> My language designer's intuition is telling me that the scoping rules
> for case..end should be more like those for fun..end.
> 
> -Chris


-- 
-------------------------------------------------------------
Lennart Ohman                   phone   : +46-8-587 623 27
Sjoland & Thyselius Telecom AB  cellular: +46-70-552 6735
Sehlstedtsgatan 6               fax     : +46-8-667 8230
SE-115 28 STOCKHOLM, SWEDEN     email   : lennart.ohman@REDACTED




More information about the erlang-questions mailing list