Re: Generalize do-expressions to statements in general?

2015-07-17 Thread Mark S. Miller
I don't see a conflict between return and being an expression language. Smalltalk and E both have return. In Scheme terms, this is simply call-with-escape-continuation. Gedanken again was probably the first to have this right with their escape construct, which E borrowed. E's method syntax

Re: Generalize do-expressions to statements in general?

2015-07-17 Thread Andreas Rossberg
On 16 July 2015 at 17:29, Mark S. Miller erig...@google.com wrote: When simply generating simple JS code from something else, this restriction is a perpetual but minor annoyance. Indeed, one motivation for do-expressions is better support for compilers targeting JS. And for some of those, not

Re: Generalize do-expressions to statements in general?

2015-07-17 Thread Matthew Robb
Just wanted to say I was playing around with the idea of using parens as block-expressions this morning and I REALLY like it. It doesn't feel like an added feature at all it just seems natural since blocks don't normally produce a value. The questions I think that remain are: 1) return? 2) yield?

Re: Generalize do-expressions to statements in general?

2015-07-17 Thread Waldemar Horwat
On 07/16/2015 13:35, Herby Vojčík wrote: Mark S. Miller wrote: I echo this. E is a dynamic language with many similarities with JS, including a similarly C-like syntax. In E I use everything-is-a-pattern-or-expression all the time. When I first moved to JS I missed it. Now that I am used to

Re: Generalize do-expressions to statements in general?

2015-07-16 Thread Andreas Rossberg
On 16 July 2015 at 15:21, Bob Myers r...@gol.com wrote: With all do respect, none of this syntax tinkering makes any sense to me. I've been programming JS for 15 years and never noticed I needed a try block that returns a value. Long ago I programmed in a language called AED that had valued

Re: Generalize do-expressions to statements in general?

2015-07-16 Thread Bob Myers
: Isiah Meadows impinb...@gmail.com, es-discuss@mozilla.org es-discuss@mozilla.org Date: Tue, 14 Jul 2015 11:18:58 -0500 Subject: Re: Generalize do-expressions to statements in general ___ es-discuss mailing list es-discuss@mozilla.org https

Re: Generalize do-expressions to statements in general?

2015-07-16 Thread Mark S. Miller
I echo this. E is a dynamic language with many similarities with JS, including a similarly C-like syntax. In E I use everything-is-a-pattern-or-expression all the time. When I first moved to JS I missed it. Now that I am used to the JS statements-are-not-expressions restrictions, I no longer do,

Re: Generalize do-expressions to statements in general?

2015-07-16 Thread Herby Vojčík
Mark S. Miller wrote: I echo this. E is a dynamic language with many similarities with JS, including a similarly C-like syntax. In E I use everything-is-a-pattern-or-expression all the time. When I first moved to JS I missed it. Now that I am used to the JS statements-are-not-expressions

Re: Generalize do-expressions to statements in general?

2015-07-16 Thread Herby Vojčík
Herby Vojčík wrote: Mark S. Miller wrote: I echo this. E is a dynamic language with many similarities with JS, including a similarly C-like syntax. In E I use everything-is-a-pattern-or-expression all the time. When I first moved to JS I missed it. Now that I am used to the JS

Re: Generalize do-expressions to statements in general?

2015-07-14 Thread Andreas Rossberg
All you are proposing is to allow the braces to be dropped from a do-expression, right? That's an obvious tweak, although I'm not sure if it really improves readability. (Other than that, do-expressions are already intended to work as you describe, using the completion value of the statement list.

Re: Generalize do-expressions to statements in general?

2015-07-14 Thread Andreas Rossberg
I don't see why you need parens at all, see my previous post. But I wouldn't make the do-less forms the base syntax,; rather, only short-hands for the general thing. In particular, because the ability to have an actual block inside an expression is one primary motivation for having do-expressions

Re: Generalize do-expressions to statements in general?

2015-07-14 Thread Matthew Robb
The only gripes I have with do expressions is the inability to specify the value produced in an obvious and uniform way, also are do expressions capable of being labelled? - Matthew Robb On Tue, Jul 14, 2015 at 3:31 AM, Andreas Rossberg rossb...@google.com wrote: I don't see why you need

Re: Generalize do-expressions to statements in general?

2015-07-14 Thread Mark S. Miller
On Tue, Jul 14, 2015 at 2:31 AM, Andreas Rossberg rossb...@google.com wrote: I don't see why you need parens at all, see my previous post. But I wouldn't make the do-less forms the base syntax,; rather, only short-hands for the general thing. In particular, because the ability to have an

Re: Generalize do-expressions to statements in general?

2015-07-14 Thread Andreas Rossberg
On 14 July 2015 at 15:04, Matthew Robb matthewwr...@gmail.com wrote: The only gripes I have with do expressions is the inability to specify the value produced in an obvious and uniform way, Well, the completion value is fairly uniform. You mean an analogue to a return in a function body?

Re: Generalize do-expressions to statements in general?

2015-07-14 Thread Andreas Rossberg
On 14 July 2015 at 16:48, Mark S. Miller erig...@google.com wrote: On Tue, Jul 14, 2015 at 2:31 AM, Andreas Rossberg rossb...@google.com wrote: I don't see why you need parens at all, see my previous post. But I wouldn't make the do-less forms the base syntax,; rather, only short-hands for

Re: Generalize do-expressions to statements in general?

2015-07-14 Thread Mark S. Miller
On Tue, Jul 14, 2015 at 10:59 AM, Andreas Rossberg rossb...@google.com wrote: On 14 July 2015 at 16:48, Mark S. Miller erig...@google.com wrote: On Tue, Jul 14, 2015 at 2:31 AM, Andreas Rossberg rossb...@google.com wrote: I don't see why you need parens at all, see my previous post. But I

Generalize do-expressions to statements in general?

2015-07-13 Thread Isiah Meadows
I was reading a recent thread https://esdiscuss.org/topic/allow-try-catch-blocks-to-return-a-value where do-expressions simplified a common try-catch use case, and I was wondering if `do` could be simplified to an expression? It would allow for this to be solved very easily, but also add a lot

Re: Generalize do-expressions to statements in general?

2015-07-13 Thread Mark S. Miller
Interesting. Got me thinking. Here's an alternate proposal I'll call do expressions without the 'do'. At https://people.mozilla.org/~jorendorff/es6-draft.html#sec-expression-statement we have the syntax of the expression statement. Ignoring sloppy let nonsense, this says that an expression

Re: Generalize do-expressions to statements in general?

2015-07-13 Thread Isiah Meadows
To be perfectly honest, though, I'm not entirely sure the specifics of the do-expression proposal, since Google is failing me here (can't find a thing giving more detail than this mailing list). And as for what my proposal here is, I forgot to mention that expression statements would be explicitly

Re: Generalize do-expressions to statements in general?

2015-07-13 Thread Isiah Meadows
On Mon, Jul 13, 2015 at 7:53 PM, Isiah Meadows impinb...@gmail.com wrote: To be perfectly honest, though, I'm not entirely sure the specifics of the do-expression proposal, since Google is failing me here (can't find a thing giving more detail than this mailing list). And as for what my

Re: Generalize do-expressions to statements in general?

2015-07-13 Thread Mark Miller
On Mon, Jul 13, 2015 at 6:53 PM, Isiah Meadows impinb...@gmail.com wrote: To be perfectly honest, though, I'm not entirely sure the specifics of the do-expression proposal, since Google is failing me here (can't find a thing giving more detail than this mailing list). And as for what my