Proposal: Non-recursive let

Andreas Abel andreas.abel at ifi.lmu.de
Wed Jul 10 10:54:57 CEST 2013


On 10.07.2013 10:00, Jon Fairbairn wrote:
> Andreas Abel
> <andreas.abel at ifi.lmu.de> writes:
>
>> Proposal: add a non-recursive let to the Haskell language.  In
>>
>>    let' p = e in e'
>>    do { ... let' p = e ... }
>>
>> the variables of pattern p are then *not* in scope in e.
>>
>> Reasons for adding a non-recursive let:
>>
>> 1. recursive-let is the source for many non-termination bugs.
>
> -1 from me. I don’t see that having non-recursive let available
> will have much impact on the bugs. It just changes forgetting to
> use different variable names because of recursion (which is
> currently uniform throughout the language) to forgetting to use
> non recursive let instead of let.

Sorry, but I cannot change history.  Ideally, "let" was non-recursive, 
and we had a "let rec" to indicate recursion.  I certainly am not going 
to propose to make "let" non-recursive.

I am not buying your argument.  I think it is easier to retrain the 
brain to use "let'" instead of "let" by default, because writing 
keywords is a background activity (like walking) and does not need the 
attention that thinking of the right variable needs.  (My brain does 
confuse names, but not articles like "der" and "das".)

Also, I want shadowing because then there are less variants of 
variables around that I can confuse.  Shadowing is a way to clean out 
the name space, to dispose of things you do not need anymore.

Cheers,
Andresa


-- 
Andreas Abel  <><      Du bist der geliebte Mensch.

Theoretical Computer Science, University of Munich
Oettingenstr. 67, D-80538 Munich, GERMANY

andreas.abel at ifi.lmu.de
http://www2.tcs.ifi.lmu.de/~abel/



More information about the Haskell-prime mailing list