Re: it would be nice to have async-blocks like ``async {some_statements}`` and ``async (some_expression)``

2017-01-03 Thread Alan Johnson
I’m all for the `async` block. In Scala, there actually are no `async` functions; only `async` blocks. (Technically, this isn’t in the language; it’s a macro from a library called scala-async .) This works out a bit more nicely because it’s expression-oriented to

Re: Try/Catch always needed for await?

2016-10-14 Thread Alan Johnson
To perhaps clarify this point a bit, it is very important to `.catch()` and react appropriately at the ends of promise chains. If synchronous code fails for an unexpected reason, a visible crash will definitely happen. This is not the case for promises, because there’s no way for the runtime to

Re: Syntax Proposal: Anonymous Arguments

2016-09-23 Thread Alan Johnson
I found the underscores in Scala confusing at first, for sure. Of course, after a couple months working with the language, you feel right at home. Worth noting that Swift does something kind of like Bash, with indexed shorthand argument names

Re: Proposal: anaphoric if and while syntax

2016-09-14 Thread Alan Johnson
What about `else if`? On Sep 14, 2016 9:28 PM, "Bergi" wrote: > Danielle McLean wrote: > > variables declared >> using `let` or `const` would be scoped to the individual `if` or `while` >> statement, rather than the containing block. In other words, the above >> syntax >>

Re: Ignoring arguments

2016-08-10 Thread Alan Johnson
What if you could use a `.` as a wildcard? I don’t think it would conflict with existing syntax, and it would avoid binding a usable identifier. It would be more obvious than nothing between the commas. > On Aug 8, 2016, at 06:33, Cyril Auburtin wrote: > > Just

Re: "Super" hoisting

2016-05-13 Thread Alan Johnson
Sounds like a potential JS engine optimization, rather than a language feature per se. > On May 12, 2016, at 1:53 PM, Brian Barnes wrote: > > Not by my testing, at least. > > My original example is a simple one to explain what the procedure is. Here’s > a more complex

Re: Proposal: ignored arguments

2016-03-04 Thread Alan Johnson
( 1, undefined, 3 ) > ``` > > Well, if an argument can be undefined like that then there might be bad > design there too, IMO. > > /#!/JoePea > > On Mar 4, 2016 3:33 AM, "Alan Johnson" <a...@breakrs.com > <mailto:a...@breakrs.com>> wrote: > Wh

Re: Proposal: ignored arguments

2016-03-04 Thread Alan Johnson
What about something like a bare `.`? Putting nothing there seems a bit error prone, but using `_` non-ideal, as it clashes with the common practice of binding utility libraries to that name. For linters, it’s nice to be able to treat unused variables as an unconditional error. > On Mar 4,

Re: Setting initialValue of Array.prototype.reduce with a default argument

2016-02-24 Thread Alan Johnson
That would prevent you from using an initial value that isn’t `undefined` while also coping with a reducer that might choose to return `undefined` — it would always be converted to the initial value, when you might actually want the `undefined` to propagate. But even without that little

Re: monadic extension to do-notation

2016-02-22 Thread Alan Johnson
If this is done, please go with `async do { … await … }`. May as well reuse existing syntax as much as possible. As mentioned, `<-` is problematic both from the standpoint of conflict with existing operators and incomplete analogy with Haskell. If the result should be Promise-ified, best to