RE: [EXTERNAL] Re: Destructuring by

2021-03-04 Thread Ron Buckton
This was mentioned up-thread, but I wrote up this proposal several years ago (https://github.com/rbuckton/proposal-refs) and am still considering bringing it to committee at some point. However, there are a larger set of cross-cutting concerns for refs in the context of a proposal like

Re: Optional Curly Braces in JavaScript

2019-11-03 Thread Ron Buckton
The '_' isn't necessary for chaining expressions, as ',' would already suffice: ``` if (foo==2) bar(), bar2(); ``` Also, '_' is already a valid expression/identifier. While I'm not generally a fan of eliding braces from everything, I have expressed interest in evaluating something like

RE: Re: What do you think about a C# 6 like nameof() expression for

2019-06-17 Thread Ron Buckton
un 16, 2019 at 12:00 AM guest271314 mailto:guest271...@gmail.com>> wrote: > > ``` > const x = nameof y > const y = 1; > ``` > > At line 1 adjacent to ```nameof``` how does the user even know that there is > a variable that will be declared named ```y```? > > What

RE: Re: What do you think about a C# 6 like nameof() expression for

2019-06-17 Thread Ron Buckton
> How is VSCode related to JavaScript? You have ignored the context from Jordan’s email (emphasis added): >> again, `Object.keys({ y })[0]` will give you the string `y`, and will >> survive refactoring tools. you can even do `function nameof(obj) { return >> Object.keys(obj)[0]; }` and then

RE: Re: What do you think about a C# 6 like nameof() expression for

2019-06-16 Thread Ron Buckton
un 16, 2019 at 12:00 AM guest271314 mailto:guest271...@gmail.com>> wrote: > > ``` > const x = nameof y > const y = 1; > ``` > > At line 1 adjacent to ```nameof``` how does the user even know that there is > a variable that will be declared named ```y```? > > What

Re: Re: What do you think about a C# 6 like nameof() expression for

2019-06-15 Thread Ron Buckton
while in this TDZ is what results in the ReferenceError. At no point does the `nameof` operator *dereference* the variable, so no error need be thrown. From: guest271314 Sent: Saturday, June 15, 4:29 PM Subject: Re: Re: What do you think about a C# 6 like nameof() expression for To: Ron Buckton Cc: es-discus

RE: Re: What do you think about a C# 6 like nameof() expression for

2019-06-15 Thread Ron Buckton
ec’d and nice-to-have capability. From: guest271314 Sent: Saturday, June 15, 2019 2:50 PM To: Ron Buckton Cc: es-discuss@mozilla.org Subject: Re: Re: What do you think about a C# 6 like nameof() expression for > It doesn’t matter what the value of ‘y’ is, just what the lexical name of `y` > is. `

RE: Re: What do you think about a C# 6 like nameof() expression for

2019-06-15 Thread Ron Buckton
It doesn’t matter what the value of ‘y’ is, just what the lexical name of `y` is. `nameof` wouldn’t refer to `y` as an expression, its just pointing to the identifier. From: guest271314 Sent: Friday, June 14, 2019 10:03 PM To: Ron Buckton Cc: es-discuss@mozilla.org Subject: Re: Re: What do

RE: Re: What do you think about a C# 6 like nameof() expression for

2019-06-14 Thread Ron Buckton
quot;value" /*4*/] = value /*5*/; } ``` If you rename the parameter `value` of the function `setValue` in an editor with a rename refactoring, you want to rename the symbols at 1, 2, 3, and 5, but not the string at 4. Ron From: guest271314 Sent: Friday, June 14, 2019 2:43 PM To: Ron Buc

RE: Re: What do you think about a C# 6 like nameof() expression for

2019-06-14 Thread Ron Buckton
> `nameof whatever` → `Object.keys({ whatever })[0]`, but I'm a bit confused > why it'd be better to type `nameof foo` in code, rather than `'foo'` - if you > change `foo` to `bar`, you have to change both of them anyways. If you are using an editor that supports rename refactoring, its

RE: Re: What do you think about a C# 6 like nameof() expression for

2019-06-14 Thread Ron Buckton
> Interesting. ```y``` would be able to be evaluated before ```y``` is defined? I very explicitly stated that `nameof y` would *not* evaluate its operand. Evaluation of `nameof` would merely result in a string containing the name of the binding referenced by the operand. From: es-discuss On

RE: Re: What do you think about a C# 6 like nameof() expression for

2019-06-14 Thread Ron Buckton
Since `nameof` does not actually evaluate anything, the following would be legal: ``` const x = nameof y; // "y" const y = 1; ``` However, the shorthand property name workaround is not legal due to TDZ: ``` const x = Object.keys({y})[0]; // error due to TDZ const y = 1; ``` With the shortand

RE: Re: What do you think about a C# 6 like nameof() expression for

2019-06-14 Thread Ron Buckton
foo.bar` were allowed `nameof` would not actually evaluate `foo.bar`, but merely result in `”bar”`. `nameof` does not evaluate anything, it is merely a syntactic transformation by the runtime that becomes a string. Ron From: guest271314 Sent: Friday, June 14, 2019 10:07 AM To: Ron Buckton Cc: es

Re: Re: What do you think about a C# 6 like nameof() expression for

2019-06-14 Thread Ron Buckton
The 'nameof' operator provides the string name of a static symbol (in compiler/linker terms, not an ECMAScript 'Symbol'). This is often useful for diagnostics (logging and errors), and gives developers a way to reduce repetition. It is also extremely helpful in editors that support symbolic

RE: Proposal: Duration

2019-03-04 Thread Ron Buckton
Personally, I’d love to see something like this included as part of the temporal proposal (https://github.com/tc39/proposal-temporal), as I’ve been experimenting with something very much like this here: https://github.com/rbuckton/temporal/blob/master/src/Duration.ts. I think a Duration type

RE: Proposal: Default object method

2019-01-27 Thread Ron Buckton
There’s nothing in that proposal says that an object with a `Symbol.apply` has to have a different `typeof`. It *would* mean that any Call might require additional dispatch which could have performance implications. It could also be an approach to support “callable” classes: ```js class Foo {

RE: Proposal for faster this assignments in constructor functions

2018-11-28 Thread Ron Buckton
Dart has something like this: https://www.dartlang.org/guides/language/language-tour#constructors ```dart class Point { num x, y; // Syntactic sugar for setting x and y // before the constructor body runs. Point(this.x, this.y); } ``` I could see a form of BindingElement (et al) that

RE: New Proposal: Placeholder syntax

2018-11-28 Thread Ron Buckton
Partial application chose to limit the scope of `?` to argument positions in an argument list for a number of reasons. The primary being this case (assuming arbitrary expressions were allowed): ```js let i = 0; const g = f({ x: i++, y: ? }); ``` The goal of partial application was to “fix”

RE: Arrow methods

2018-11-18 Thread Ron Buckton
C# has a similar syntax for shorthand expression bodies (https://github.com/dotnet/roslyn/wiki/New-Language-Features-in-C%23-6#expression-bodies-on-method-like-members): ```cs class Point { private int x; private int y; … // expression bodied getters (read-only) public int X => x;

RE: Array.prototype.remove(item)

2018-10-10 Thread Ron Buckton
That depends entirely on what the return value means. Returning Boolean from `add` doesn’t mean, “does the value now exist in the set”, but rather means “was the set modified as a result of this operation”. To avoid any possible performance cost for calling `has` before `add`, I usually have

RE: Proposal: Add Map.prototype.putIfAbsent

2018-10-10 Thread Ron Buckton
I have seen this in other languages as `getOrCreate(key, valueFactory)`. Dictionaries in .NET have a `TryGetValue(key, out value)` method that returns a boolean and has an ‘out’ parameter used to assign the value if it exists. The performance issue regarding keys is one of my common concerns

RE: Pointers

2018-03-19 Thread Ron Buckton
> -Original Message- > From: Pier Bover <pierbove...@gmail.com> > Sent: Monday, March 19, 2018 5:06 PM > To: Isiah Meadows <isiahmead...@gmail.com> > Cc: Ron Buckton <ron.buck...@microsoft.com>; es-discuss disc...@mozilla.org> > Subject: Re: Poi

RE: Pointers

2018-03-19 Thread Ron Buckton
> -Original Message- > From: es-discuss On Behalf Of Isiah > Meadows > Sent: Monday, March 19, 2018 3:21 PM > To: Michael J. Ryan > Cc: es-discuss > Subject: Re: Pointers > > And even if we *could* get pointers

RE: Picking (deconstructing) properties into object literals

2017-08-22 Thread Ron Buckton
As a alternative, consider https://github.com/rbuckton/proposal-shorthand-improvements. From: kai zhu Sent: Tuesday, August 22, 2017 9:45 PM To: Isiah Meadows Cc: es-discuss@mozilla.org Subject: Re: Picking

RE: Stream + async await

2017-07-29 Thread Ron Buckton
One option might be something like https://github.com/rbuckton/prex/blob/master/docs/scheduling.md#class-asyncqueue. It allows you to put items on the queue as soon as they are available. Ron From: Naveen Chawla Sent: Saturday, July 29, 2017 3:54 AM To: Domenic

RE: Re: Functional Operators

2017-07-16 Thread Ron Buckton
arr.reduce(Math.add)`\*. Assuming it is and I’m just failing to see it, is the benefit significant enough to merit new syntax? (On further consideration, maybe `Reflect.add`, since `+` is not specific to numeric values...) On Sun, Jul 16, 2017 at 2:19 AM, Ron Buckton <ron.buck...@microsoft.

RE: Re: Functional Operators

2017-07-16 Thread Ron Buckton
I have been looking into functional operators while working on a proposal for pipeline and partial application. I’ve found that a sigil like `{+}` is just as ergonomic as `(+)`, but has fewer lookahead issues with respect to regular expression parsing. While `(/)` is ambiguous as to whether it

RE: Allowing object field name shorthand

2017-06-25 Thread Ron Buckton
There is one place where I could see this syntax being useful, though with different semantics, is a feature from C# that I seen used to good effect: Dotted names for shorthand property assignments. For example: ``` const results = books.map(x => ({ x.isbn, x.title,

RE: Array pointer getter?

2017-06-02 Thread Ron Buckton
I recently put together https://github.com/rbuckton/ecmascript-ref which is somewhat similar to this. From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Alex Falcon Sent: Friday, June 2, 2017 9:06 AM To: es-discuss@mozilla.org Subject: Array pointer getter? Hello. I heard

RE: throwif operator

2017-04-11 Thread Ron Buckton
I’d much rather see something more like C# 7’s throw expressions: https://docs.microsoft.com/en-us/dotnet/articles/csharp/whats-new/csharp-7#throw-expressions ```js // original example fs.writeFile("message.txt", "Hello Node.js", err => err ? throw err : console.log("The file has been saved.");

RE: Resource management

2016-12-31 Thread Ron Buckton
> -Original Message- > From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Isiah > Meadows > Sent: Saturday, December 31, 2016 8:34 AM > To: J Decker > Cc: Raul-Sebastian Mihăilă ; es-discuss disc...@mozilla.org> > Subject: Re:

RE: expanding comments proposal

2016-10-21 Thread Ron Buckton
> From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Gert > Cuykens > Sent: Friday, October 21, 2016 4:56 PM > To: Tab Atkins Jr. > Cc: Bruno Jouhier ; es-discuss disc...@mozilla.org> > Subject: Re: expanding comments proposal > >

RE: Promises as Cancelation Tokens

2016-01-04 Thread Ron Buckton
This gist contains the TypeScript declarations for the version of CancellationToken I’ve been using for a number of small projects. The basic API shape is: ```ts class CancellationTokenSource { constructor(linkedTokens?:

RE: Re: Propose simpler string constant

2015-12-16 Thread Ron Buckton
In C#, an enum is a declaration that defines a distinct type consisting of a set of named constant values of that type. The distinct type of the enum has an underlying numeric base type, such as byte, int, long, etc. By default, each constant value is assigned an incrementing integer value

RE: Reflection to know if executed within a generator/async ?

2015-12-03 Thread Ron Buckton
I agree with Bradley, and kindly refer you to this oft referenced blog post regarding synchronous and asynchronous APIs: http://blog.ometer.com/2011/07/24/callbacks-synchronous-and-asynchronous/ Ron From: Bradley Meck Sent: Thursday, December 3, 2015 8:57 AM To: Andrea Giammarchi Cc:

RE: Decorators for functions

2015-10-22 Thread Ron Buckton
Andrea, Is your concern about disambiguating the usage of a decorator at the call site or within the body of the decorator? In the current proposal, you can decorate a class member, or the class itself. When decorating a class member, three arguments are passed to the decorator: The target,

RE: Decorators for functions

2015-10-22 Thread Ron Buckton
> -Original Message- > From: Andrea Giammarchi [mailto:andrea.giammar...@gmail.com] > Sent: Thursday, October 22, 2015 12:53 PM > Ron, there's **no way** you can distinguish a class from a generic function > in current specifications. Yes, this is true. However, decorators aren't in the

RE: Exporting Symbols

2015-10-15 Thread Ron Buckton
Wouldn’t this work? our-symbols.js: ```js export const SpecialSymbol = Symbol("SpecialSymbol"); ``` their-consumer.js ```js import { SpecialSymbol } from "our-symbols"; export const features = { [SpecialSymbol]: true }; ``` our-features.js ```js import { SpecialSymbol } from "our-symbols";

RE: Template strings as a template language.

2015-09-13 Thread Ron Buckton
This is theoretically possible: ``` let t = $template` ${$item.permalink} ${$each($item.comments)` ${$parent.permalink} ${$if($item.title)` ${$parent.permalink} `} `} `; let s = t(data); ``` ...given an adequate implementation using proxies (to create bindings for e.g.

RE: What do you think about a C# 6 like nameof() expression for JavaScript.

2015-08-09 Thread Ron Buckton
of any other language that has this at the syntax level (not macro)? On Sat, Aug 8, 2015, 23:12 Ron Buckton ron.buck...@microsoft.commailto:ron.buck...@microsoft.com wrote: One of the main purposes of the `nameof` operator is to provide the string value of a symbol, so that if you perform a Rename

RE: What do you think about a C# 6 like nameof() expression for JavaScript.

2015-08-08 Thread Ron Buckton
One of the main purposes of the `nameof` operator is to provide the string value of a symbol, so that if you perform a Rename refactoring of that symbol that the change is also reflected. This is primarily for cases where you perform precondition assertions tied to an argument: ``` ...

RE: let function

2015-05-14 Thread Ron Buckton
I proposed something similar to this among the folks investigating decorators for ES7: https://github.com/jonathandturner/decorators/issues/17 In this case, it was for a `const function`, as a means to allow a decorator on a function declaration, as adding the `const` (or `let`) would

RE: Array.prototype.find - Proposal for (breaking) change of API

2015-04-07 Thread Ron Buckton
Even more off-topic, I’m sure, but with http://github.com/rbuckton/queryjs (a query library over iterables) and ES6 you can do: ``` import { Query } from './query'; let files = [main.md, backup.md]; let base = /my/root; let found = Query .from(files) .map(file = path.resolve(base, file))

RE: Existential Operator / Null Propagation Operator

2015-04-07 Thread Ron Buckton
Brendan Eich wrote: Brendan Eich wrote: Caitlin Potter wrote: 6, 2015 at 5:42 PM, Brendan Eichbrendan at mozilla.org https://mail.mozilla.org/listinfo/es-discuss wrote: / Did you keep backward compatibility? `x?.1:y` must continue to work. / ​This is why I suggested a

RE: Existential Operator / Null Propagation Operator

2015-04-07 Thread Ron Buckton
@mozilla.orgmailto:es-discuss@mozilla.org Subject: Re: Existential Operator / Null Propagation Operator Ron Buckton wrote: The reduce/reduce conflict recognizing a left sentential form '[' E ']' vs. M '?' '[' E ']' shows the fatal ambiguity. /be There is also ambiguity due to ASI vs

RE: Existential Operator / Null Propagation Operator

2015-04-06 Thread Ron Buckton
Wouldn't `.?` as an infix operator be unambiguous, compared to `?.`? There's no place other than decimal literals where this would be legal today, and decimal literals already require either parenthesis or an extra dot to perform a property access in any event. With that lexeme, `x.?1:y` would

RE: Forwarding `return()` in generators

2015-03-24 Thread Ron Buckton
Is your goal to wrap a generator, as it seems you are propagating the exception of the caller by calling iterator.throw(). However, you do not seem to be propagating the sent value, so the protocol here isn’t fully implmeneted. If you just want to iterate values (and don’t really care about the

RE: Cancellation architectural observations

2015-03-04 Thread Ron Buckton
new Promise(resolve = doLater(resolve, cts.token)).then(handleResult); setImmediate(() = cts.cancel()); In this scenario cancel would be called right after the resolve method is called, but before handlerResult is called. For this to work with a cancellation token you would need to pass

Re: Cancellation architectural observations

2015-03-02 Thread Ron Buckton
From: Andrea Giammarchi andrea.giammar...@gmail.com Sent: Monday, March 02, 2015 4:18 PM To: Ron Buckton Cc: Dean Tribble; Kevin Smith; public-script-co...@w3.org; es-discuss Subject: Re: Cancellation architectural observations So this is my simplified view

Re: Cancellation architectural observations

2015-03-02 Thread Ron Buckton
The upside of having a separate abstraction for cancellation, is that it composes well with async functions: ```js async function runStockTicker(receiveSymbol, cancellationToken) { while (!cancellationToken.canceled) { var symbols = await fetchSymbols(cancellationToken); if

Re: Cancellation architectural observations

2015-03-02 Thread Ron Buckton
Cancellations should chain == If you have a cancellable promise p1, and use .then() to produce a new promise p2, p2 should also be cancelable, and in the default case, should chain up to p1 and cause it to cancel as well. The CTS/Token approach can do this directly

Re: Cancellation architectural observations

2015-03-02 Thread Ron Buckton
. Ron From: Kevin Smith zenpars...@gmail.com Sent: Monday, March 02, 2015 6:42 PM To: Ron Buckton Cc: public-script-co...@w3.org; es-discuss Subject: Re: Cancellation architectural observations Cancellation * Cancellation signals are produced by the caller

RE: Cancelable promises

2015-02-27 Thread Ron Buckton
AsyncJS (http://github.com/rbuckton/asyncjs) uses a separate abstraction for cancellation based on the .NET CancellationTokenSource/CancellationToken types. You can find more information about this abstraction in the MSDN documentation here:

RE: (x) = {foo: bar}

2015-01-05 Thread Ron Buckton
For better or worse, C# avoids this ambiguity through the use of the `new` operator: ``` f = x = y = new { x, y }; ``` Of course, C# does not support creating an object literal (nee. anonymous type) without `new`, but using `new` here would be generally unambiguous in ES7+. Although its legal

RE: generator libraries

2015-01-03 Thread Ron Buckton
I wrote http://github.com/rbuckton/queryjs Sent from my Windows Phone From: Aaron Powellmailto:m...@aaron-powell.com Sent: ‎1/‎3/‎2015 6:26 PM To: 'Mark Volkmann'mailto:r.mark.volkm...@gmail.com; es-discuss@mozilla.orgmailto:es-discuss@mozilla.org Subject: RE:

RE: Elegant way to generate string from tagged template?

2014-12-23 Thread Ron Buckton
For ES6 you could use http://github.com/rbuckton/QueryJS like this: ``` var a = [1,2,3]; var b = [a, b, c] var c = Query .from(a) .zip(b, (a, b) = [a, b]) .flatMap(a = a) .toArray() .join(); ``` Ron Sent from my Windows Phone From: Brendan

[ES7+] Promise cancellation (was: Re: Promise-returning delay function)

2014-10-28 Thread Ron Buckton
The direction I've taken around Promise cancellation given the API surface of the ES6 Promise has been to use a different object to handle cancellation. This approach is similar to the Cooperative Cancelation model used in .NET. The API for this looks something like the following (using

Should `Set.prototype.add` return boolean instead of `this`?

2014-10-16 Thread Ron Buckton
??I recall from earlier discussions on this list that the reason `Set.prototype.add` returns `this` is to support chained calls to the set, to add multiple items, similar to how some libraries like jQuery operate, for example: ``` var s = new Set(); s.add(1).add(2).add(3); ``` I have

Proposal: Promise.prototype.Finally

2014-08-18 Thread Ron Buckton
I created the following gist as a proposal for the addition of a `finally` method to the prototype of the Promise constructor, either for ES6 (if such a thing is considered valuable and could be fast tracked at this date), or for ES7. This method would take in a single callback that would be

RE: Proposal: Promise.prototype.Finally

2014-08-18 Thread Ron Buckton
From: Domenic Denicola dome...@domenicdenicola.com Sent: Monday, August 18, 2014 3:20 PM To: Ron Buckton; EcmaScript Subject: RE: Proposal: Promise.prototype.Finally Here is the current design for Promise.prototype.finally. I agree it is a useful feature. https://github.com/domenic

RE: Overriding Map/etc with get/set hooks?

2014-08-11 Thread Ron Buckton
Sorry for the short reply here, as I'm not at my PC. Would having an @@isValue (Map) and @@isKey (Set/Map) work? Set.prototype[@@isValue] = value = true; // default Built -in Set operations would check values against @@isValue and throw. You can then override it in your subclass and make it

RE: Overriding Map/etc with get/set hooks?

2014-08-11 Thread Ron Buckton
That should have been @@isValue (Set/Map) and @@isKey (Map. The downside of having an @@isValue filter is that there are likely still ways to get around it (subclasses could define their own, create a new object whose [[Prototype]] is an instance of your subclass with its own @@isValue, etc.).

RE: ModuleImport

2014-06-24 Thread Ron Buckton
If it is considered legal, then I'd say maybe the default export should be named @@default (or a similar symbol) instead. Ron Sent from my Windows Phone From: Calvin Metcalfmailto:calvin.metc...@gmail.com Sent: ‎6/‎24/‎2014 5:47 PM To: Kevin

RE: ModuleImport

2014-06-20 Thread Ron Buckton
-Original Message- From: es-discuss [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Sébastien Cevey Sent: Friday, June 20, 2014 3:46 AM To: Axel Rauschmayer Cc: es-discuss list Subject: Re: ModuleImport On 20 June 2014 11:39, Axel Rauschmayer a...@rauschma.de wrote:

RE: ModuleImport

2014-06-20 Thread Ron Buckton
From: John Barton [mailto:johnjbar...@google.com] Sent: Friday, June 20, 2014 3:48 PM ES6 already has what you want: _Named Exports_: export var foo = 1; _Single Export Object_: export var moduleName = { foo: 1, bar: function() {} }; _Single Export Function_: export

RE: Decorators vs Annotations (was April 10 2014 Meeting Notes)

2014-04-15 Thread Ron Buckton
-Original Message- From: Erik Arvidsson [mailto:erik.arvids...@gmail.com] Sent: Tuesday, April 15, 2014 8:38 AM To: waldron.r...@gmail.com; es-discuss@mozilla.org; Yehuda Katz Cc: Ron Buckton Subject: Decorators vs Annotations (was April 10 2014 Meeting Notes) On Tue Apr 15 2014

RE: Promise.cast and Promise.resolve

2014-02-05 Thread Ron Buckton
Perhaps the unwrapping behavior of .then could be specified as an optional argument in the Promise constructor and .resolve methods. The default behavior is the current standard (i.e. .then auto-unwraps), but a different behavior could be specified: ``` var unwrapPromise1 =

RE: Promises: final steps

2013-09-05 Thread Ron Buckton
Tasks in C# throw the recorded exception when the Task is finalized by the GC if it hasn't been handled by user code, though I don't know if something similar could be supported for ES7 Promises nor whether or not that makes sense for ES7 promises either. Having Promise rejections hold on to

RE: Letting RegExp method return something iterable?

2013-08-28 Thread Ron Buckton
The advantage of a lazy execAll, is the ability to break out of the for..of loop without the need to continue to traverse the input string looking for matches. This is the same advantage that the `while(m = re.exec())` has going for it. You can always be greedy by using Array.from or an array

RE: Killing `Promise.fulfill`

2013-08-19 Thread Ron Buckton
Promise.fulfill/PromiseSource#fulfill made sense when there was no unwrap on the input side of Promise#then: *then:* ```js var foreverPending = new Promise(() = {}); Promise.fulfill(foreverPending).then(x = assert(x === foreverPending)) Promise.resolve(foreverPending).then(() = { /* never

RE: setImmediate

2013-08-09 Thread Ron Buckton
For promises using microtasks, one possibility I've been experimenting with in my polyfill is a Promise.yield() method that returns a Promise that resolves after the next time the UI thread gets a chance to drain its event queue (either through requestAnimationFrame or setTimeout). While it

RE: generators vs forEach

2013-07-15 Thread Ron Buckton
Bruno, wouldn't yield* work here to delegate the inner yields? Sent from my Windows Phone From: Bruno Jouhiermailto:bjouh...@gmail.com Sent: ‎7/‎15/‎2013 4:12 PM To: es-discussmailto:es-discuss@mozilla.org Subject: Re: generators vs forEach There is no need to

RE: generators vs forEach

2013-07-15 Thread Ron Buckton
I assume you are referring to something like Q.async/Q.spawn to turn the generator into an async function using promises? Sent from my Windows Phone From: Ron Bucktonmailto:rbuck...@chronicles.org Sent: ‎7/‎15/‎2013 5:02 PM To: Bruno

RE: Why does Array.from also take a mapFn?

2013-06-30 Thread Ron Buckton
Couldn't you just do: var squaredSmalls = Int16Array.from((v*v for v of smalls)); Or is the allocation of a generator expensive enough to warrant the mapFn argument? Alternatively, is it the need to support a map on a non-iterable array-like? Ron Sent from my Windows Phone

Re: Where'd Promise#done go?

2013-06-18 Thread Ron Buckton
I've often looked at Promise#then() as sugar over Promise#done() for something like: ```js Promise.prototype.then = function(resolve, reject) { return new Promise(resolver = { this.done( value = { try { resolver.resolve(resolve ? resolve(value) : value); }

Re: The Paradox of Partial Parametricity

2013-05-27 Thread Ron Buckton
My apologies, I've seen three use cases. The third use case being the ability to send progress notifications. Sent from Windows Mail From: Ron Buckton Sent: ‎Monday‎, ‎May‎ ‎27‎, ‎2013 ‎12‎:‎47‎ ‎PM To: Andreas Rossberg, Tom Van Cutsem Cc: Mark S. Miller, Brendan Eich, es-discuss

RE: Non-generic traps for non-generic objects (was: Overriding Map/etc with get/set hooks?)

2013-05-24 Thread Ron Buckton
Another way to look at this is that there is no way to prevent a caller from using methods from the superclass on a subclass. In other OO languages, its much harder (or nearly impossible depending on the language) to forcibly call a superclass method against a subclass that has been overridden

Re: Overriding Map/etc with get/set hooks?

2013-05-21 Thread Ron Buckton
What if the default Map prototype had a configurable but non-writable data property for a @@coerceKey symbol that pointed to a default coercion function. You could subclass Map and provide your own @@coerceKey implementation. Then Map.prototype.set.call() would be forced to run the custom

RE: The Paradox of Partial Parametricity

2013-05-10 Thread Ron Buckton
Following Tab's comments on the a Promise monad, I prototyped a Future library based on DOM Future using TypeScript. Since TS has no concept of a union type, I'm using TS overloads to approximate the RefT union type example. It has roughly the following API: ```ts class FutureResolverT {

RE: Future cancellation

2013-05-01 Thread Ron Buckton
This is where something like an external cancellation source could be more effective: ```js function getUser1(cancelToken) { return doXHR(/user.json, cancelToken); } function getUser2(cancelToken) { // immediate result, no need for cancellation return { name: domenic }; } function

Re: Future cancellation

2013-04-30 Thread Ron Buckton
to catalogue each approach as I’ve come across them specifically to gather this kind of feedback. Best regards, Ron Sent from Windows Mail From: Alex Russell Sent: ‎Tuesday‎, ‎April‎ ‎30‎, ‎2013 ‎2‎:‎54‎ ‎AM To: Ron Buckton Cc: es-discuss, public-script-co...@w3.org, Tab Atkins Jr. These are horribly

RE: Future cancellation

2013-04-30 Thread Ron Buckton
, 2013 4:47 PM To: Ron Buckton Cc: es-discuss; public-script-co...@w3.org; Tab Atkins Jr. Subject: Re: Future cancellation On Mon, Apr 29, 2013 at 6:57 PM, Ron Buckton rbuck...@chronicles.org wrote: I've created separate gists for three different ways that I am currently investigating

RE: Future cancellation

2013-04-30 Thread Ron Buckton
-Original Message- From: Domenic Denicola [mailto:dome...@domenicdenicola.com] Sent: Tuesday, April 30, 2013 9:25 PM To: Jonas Sicking; Ron Buckton Cc: public-script-co...@w3.org; es-discuss Subject: RE: Future cancellation From: es-discuss-boun...@mozilla.org [mailto:es-discuss

RE: yield* desugaring

2013-04-29 Thread Ron Buckton
Was there consensus on the return value of the various generator methods being { value?, done? } for next/send/throw? Is it needed for close? The desugaring for yield* in the face of using { value?, done? } is more likely (without refutable matching or let expressions for the moment): ```js

RE: A Challenge Problem for Promise Designers

2013-04-29 Thread Ron Buckton
To: Mark Miller Cc: David Sheets; Mark S. Miller; es-discuss; public-script-co...@w3.org; Ron Buckton; David Bruant; Dean Tribble Subject: Re: A Challenge Problem for Promise Designers On Sat, Apr 27, 2013 at 5:46 PM, Mark Miller erig...@gmail.com wrote: I am worried that we're again

RE: yield* desugaring

2013-04-29 Thread Ron Buckton
-Original Message- From: Andy Wingo [mailto:wi...@igalia.com] Sent: Monday, April 29, 2013 11:56 AM To: Ron Buckton Cc: Brendan Eich; es-discuss Subject: Re: yield* desugaring On Mon 29 Apr 2013 19:25, Ron Buckton rbuck...@chronicles.org writes: The desugaring for yield

RE: A Challenge Problem for Promise Designers

2013-04-29 Thread Ron Buckton
-Original Message- From: Tab Atkins Jr. [mailto:jackalm...@gmail.com] Sent: Monday, April 29, 2013 11:21 AM To: Ron Buckton Cc: Mark Miller; David Sheets; Mark S. Miller; es-discuss; public-script- co...@w3.org; David Bruant; Dean Tribble Subject: Re: A Challenge Problem for Promise

RE: A Challenge Problem for Promise Designers

2013-04-29 Thread Ron Buckton
-Original Message- From: Tab Atkins Jr. [mailto:jackalm...@gmail.com] Sent: Monday, April 29, 2013 1:20 PM To: Ron Buckton Cc: Mark Miller; David Sheets; Mark S. Miller; es-discuss; public-script- co...@w3.org; David Bruant; Dean Tribble Subject: Re: A Challenge Problem for Promise

Future cancellation

2013-04-29 Thread Ron Buckton
I've created separate gists for three different ways that I am currently investigating as a means to support the cancellation of a Future. These can be found here: 1. Cancellation using Future: https://gist.github.com/rbuckton/5486149 2. Cancellation using Future.cancelable:

Re: A Challenge Problem for Promise Designers

2013-04-27 Thread Ron Buckton
Here is a case where flattening helps: function executeAndWaitForComplete(command) { return getJSON(commandUrl + command) .then(function (commandResult) { if (commandResult.complete) { return commandResult.model; } var statusUrl = commmandResult.statusUrl;

RE: Futures

2013-04-26 Thread Ron Buckton
I have an implementation in Typescript/ES5 at https://github.com/rbuckton/promisejs/tree/master/Variations with a test suite that can be run from node. Ron Sent from my Windows Phone From: Kevin Smithmailto:zenpars...@gmail.com Sent: ‎4/‎26/‎2013 11:47 AM To:

Re: A Challenge Problem for Promise Designers (was: Re: Futures)

2013-04-25 Thread Ron Buckton
I’m not sure I fully grok the use cases for FutureResolver#accept and having FutureFuturevalue. Having to call an Unwrap extension method on a TaskTaskT in .NET is an unfortunate necessity. Also, since Future#then implicitly resolves a future it is difficult to return a FutureFuturevalue from

RE: Futures (was: Request for JSON-LD API review)

2013-04-24 Thread Ron Buckton
Resending due to a mail error. -Original Message- From: es-discuss-boun...@mozilla.org [mailto:es-discuss- boun...@mozilla.org] On Behalf Of Tab Atkins Jr. Sent: Wednesday, April 24, 2013 11:18 AM To: Domenic Denicola Cc: Mark S. Miller; es-discuss Subject: Re: Futures (was:

RE: Futures (was: Request for JSON-LD API review)

2013-04-24 Thread Ron Buckton
Be it Promise or Future, instanceof won't work across frames. It would likely still require a Future.isFuture/Promise.isPromise just as we need to have Array.isArray now. That is, of course, unless we can use symbols for branding in a fashion that library authors could use without forking their

Re: Futures

2013-04-23 Thread Ron Buckton
The ‘await’ keyword in C# is paired with a special function declaration (similar to function* as proposed for ES6) that can be used in one of three ways: async void Foo() { ... } async Task Foo() { ... } async TaskT Foo() { ... } The ‘async’ keyword here flags the method for special case

RE: Futures

2013-04-23 Thread Ron Buckton
I fall mostly under the native futures should not implicitly chain library futures camp. Its easy enough to write: var p = // some thenable return new Future(resolver = p.then(resolver.resolve, resolver.reject); One thing that I find a bit icky is that implicitly attaching to then not only is

RE: Futures (was: Request for JSON-LD API review)

2013-04-23 Thread Ron Buckton
cases in a Future-based AMD module loader I'm tinkering with. Ron -Original Message- From: Tab Atkins Jr. [mailto:jackalm...@gmail.com] Sent: Friday, April 19, 2013 6:42 PM To: Ron Buckton Cc: Kevin Gadd; es-discuss Subject: Re: Futures (was: Request for JSON-LD API review) On Fri, Apr 19

RE: Futures

2013-04-23 Thread Ron Buckton
Perhaps Future should have a static Future.cancelable method (similar to Proxy.revocable): let { future, cancel } = Future.cancelable(function(resolver) { .. do future stuff .. }); You would still need a means to hook cancellation, possibly by replacing cancel to the caller: function

Re: Futures (was: Request for JSON-LD API review)

2013-04-19 Thread Ron Buckton
like the EventStreams proposal as well. Best regards, Ron Sent from Windows Mail From: Alex Russell Sent: ‎Friday‎, ‎April‎ ‎19‎, ‎2013 ‎4‎:‎58‎ ‎AM To: Ron Buckton Cc: Anne van Kesteren, Mark S. Miller, es-discuss, public-script-co...@w3.org, Markus Lanthaler, Douglas Crockford, Norbert Lindenberg

RE: Futures (was: Request for JSON-LD API review)

2013-04-19 Thread Ron Buckton
From: Tab Atkins Jr. [mailto:jackalm...@gmail.com] Sent: Friday, April 19, 2013 3:14 PM On Fri, Apr 19, 2013 at 2:24 PM, Ron Buckton rbuck...@chronicles.org wrote: Progress notifications are a bit of a mixed bag for me. My first implementations of Future didn’t have them, but I had

  1   2   >