Just a random thought, but would `{= =}` work for expression blocks?
```js
// plain block
const foo = {= let a = 1; a =};
assert.equal(foo, 1)
// if-else
let cond = false
const bar = {= if (cond) "hi" else "bye" =};
assert.equal(bar, "bye")
// try-catch
let e = new Error()
const error = {= try
Yes, there's been a bit of talk about modifying the `do` proposal in
various ways (like allowing more than a block, using `=` to
differentiate, etc.), but each of these have potential ambiguities
(like conflicting with `do-while` or object literal syntax,
respectively), and give unintuitive
Beat you to it by about a year ;-)
https://esdiscuss.org/topic/generalize-do-expressions-to-statements-in-general
And to be quite honest, I did find it got some interest from TC39, but it
was one of them IIRC that pointed out the ambiguity with `do { ... } while
(...)`, in which the fix would
> there isn't much difference from the `do expression`, actually, it might be
> worse since it looks confusing. if it can not be omitted, I'd rather stay
> with `do`.
I thought omitting additional brackets(`var foo = = if (cond) { bar } else {
baz }`) was most sweet spot in this proposal than
I like the idea of expressions over statements (it's actually my
preference), but not at the cost of breaking *everything* (feel free to
fork Acorn/Escodegen and create your own transpiled JS variant - their
licenses permit it), so my support of your particular idea is pretty much
nil, at least in
On 10/31/16 2:39 PM, Herby Vojčík wrote:
Jan-Ivar Bruaroey wrote:
On 10/28/16 8:39 AM, Bergi wrote:
Jan-Ivar Bruaroey wrote:
If you try the fiddle - http://jsfiddle.net/jib1/jz33qs32/ - you'll
see
cancelling terminates the chain. If you intersperse non-cancellable
operations, there'd be a
Isiah, In your case, if we do
```
var x = = { a }
```
there isn't much difference from the `do expression`, actually, it might be
worse since it looks confusing. if it can not be omitted, I'd rather stay
with `do`.
The intent for this proposal is to allow writing better functional code in
7 matches
Mail list logo