Pal-Kristian Engstad wrote:
> Jonathan S. Shapiro wrote:
>> This is a completely separate issue. For the moment, the question I
>> want to focus on is how to separate the end of the expression that is
>> scoped by the let from the end of the entire let. Let's stick with
>> that.
>
> This is really an issue of sequencing using semi-colon, right? This is 
> an issue because one mixes statements and expressions. I'd prefer to 
> have a stronger syntactical difference between the two. This can be 
> achieved by using do { stmt; strmt } for a block. Then you'd get
> 
>     do { let x = 1 in x;
>          let y = x + 2 in y }  // Unbound value: x
> 
> Or:
> 
>     let x = 1 in do { x; let y = x + 2 in y } // Ok.
> 
> You can argue that the above is a bit strange. One solves that by 
> creating a new form of let that doesn't use "in":
> 
>     do { let x = 1;            // A different let, lives until end of scope.
>          let y = x + 2;        //
>          y }

I like this, although perhaps the different scoping should be signalled
by a different keyword (maybe 'var' or 'def'?).

> You could even let go of the "let" in this case:
> 
>     do { x = 1;
>          y = x + 2;
>          y }
> 
> This shouldn't be a problem if assignment uses a different syntax.

-1 for dropping the keyword starting a declaration. Scanning backward
for the declaration of a variable is something that needs to be as quick
and minimally error-prone as possible. '=' isn't sufficiently visually
distinct to satisfy that.

-- 
David-Sarah Hopwood ⚥

_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to