Deprecating Future's .then()
waldron.rick at gmail.com
Wed Jun 5 07:59:36 PDT 2013
On Wed, Jun 5, 2013 at 5:29 AM, Tom Van Cutsem <tomvc.be at gmail.com> wrote:
> 2013/6/4 Tab Atkins Jr. <jackalmage at gmail.com>
> On Wed, Jun 5, 2013 at 12:51 AM, Mark S. Miller <erights at google.com>
>> > I am making here only an argument that .then's result behavior should be
>> > flatMap-like rather than .map-like. As for which of these the .chain
>> > prefers for .chain's result behavior, I am neutral. But if they choose
>> > .map-like, they'd be able to avoid the ugly assimilation hack.
>> Given that .chain is just a proposed name for the monadic operation,
>> which could also be called .flatMap, obviously the return value's
>> behavior should be flatMap like.
> Here's another argument I haven't heard before:
> .flatMap seems like an excellent name because it immediately provides a
> clue as to what it does without having to look up any docs at all. Given
> that as a JS dev you know array.map(), you'll have some intuition that
> .flatMap() does what map() does, with flattening (it's a pity we don't have
> array.flatten() ).
> Similarly, Promise.of(val) is way clearer than Promise.accept/fulfill, if
> you compare it to Array.of(val) (not sure we eventually agreed to add such
> a method,
To clarify for Tom and anyone else following that was unsure:
Array.of(...items) has been spec'ed and is located at 220.127.116.11 of rev15
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss