Re: detecting JS language mode for tools

2014-01-26 Thread Kevin Smith
Once you focus on inline bodies, you face harsh adoption barriers without enabling works-in-old-and-new coding. OK, I follow. ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: detecting JS language mode for tools

2014-01-24 Thread Kevin Smith
7) Hence, it probably makes sense to promote a convention of using a new file extension for ES6 source files that are intended to be parsed with the modules goal. .jsm, or mjs, or something similar that is appropriately suggestive and isn't already widely used as an extension. Allen, I'm

Re: detecting JS language mode for tools

2014-01-24 Thread Kevin Smith
I'm perfectly happy with convention of some kind: a) a file extension b) a comment on the first line of the file: // module mymodule c) a use strict style annotation that is just documentation: module mymodule; One of the nicest things about the current modules syntax is that it avoids

Re: New ES6 spec draft (Rev 22, Jan 20, 2014)

2014-01-21 Thread Kevin Smith
Couple of nits WRT modules: - The instantiationRequest interface is defined as having two properties: execute and deps. I believe deps should be spelled dependencies to match the naming conventions throughout the rest of the document. Besides that, there is no reason that I can see to optimize

Re: New ES6 spec draft (Rev 22, Jan 20, 2014)

2014-01-21 Thread Kevin Smith
First, there are plenty of standard bindings on the global object that are not constructors and yet are capitalized -- `Math` is a prime example here. Math (and Reflect, JSON, etc) are functioning not as objects with per-instance state, but as namespaces. Infinity is a value object, but

Re: Standard modules?

2014-01-19 Thread Kevin Smith
I'm inclined to say this has missed the train for ES6. That may be fine. It seems like we would use a little more experience with ES6 modules before we tackle this. Definitely. It appears that the only thing in the ES6 draft which mentions standard modules is GeneratorFunction. Will that

Re: Equality Reform(ul)ation

2014-01-16 Thread Kevin Smith
What's the method for determining whether we run the multimethod dispatch algorithm versus the ES6 abstract equality algorithm? One or both operands value objects. Gotcha. One more, I think. int64(0) === 0L I assume that int64 is not defined as a composition of primitives or value

Re: Equality Reform(ul)ation

2014-01-16 Thread Kevin Smith
[oops - reply all this time] Value objects have value, not reference, semantics. JS has string number boolean already (note lowercase names). With value objects, users and the host env can define others. Makes sense, but I thought the user could not define semantics for ===: it just means

Equality Reform(ul)ation

2014-01-15 Thread Kevin Smith
js 0L == 0 typein:2:0 TypeError: no operator function found for == And what does this do? 0L == { valueOf() { return 0 } } Is the Object-type operand converted to a primitive before the overload is matched? ___ es-discuss mailing list

Re: Equality Reform(ul)ation

2014-01-15 Thread Kevin Smith
js 0L == { valueOf: function() { return 0 } } typein:2:0 TypeError: no operator function found for == Is the Object-type operand converted to a primitive before the overload is matched? No, the multimethod dispatch algorithm runs. Even with ToObject (I see I left that out), there is

Re: Operator overloading for non-value objects

2014-01-14 Thread Kevin Smith
In the worst case, when I don't know if I have a string or an URLUtils object, I just ensure that at least one member of the equality operator is stringified—and, most importantly, that it is evident from reading my code that one member is stringified: a.href == url

Re: Operator overloading for non-value objects

2014-01-14 Thread Kevin Smith
In JS world we are use to compare via === so that when == is used instead we are usually in power user land, I don't see any conceptual shenanigans in doing something like above code. Only power users use == because it has weird conversion semantics that are hard to internalize. == doesn't

Re: Operator overloading for non-value objects

2014-01-14 Thread Kevin Smith
== is overloadable along with and = to cope with unordered values and to enable common safe comparisons, e.g. 0m == 0. What does 0m === 0 mean? ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Operator overloading for non-value objects

2014-01-14 Thread Kevin Smith
`0m` is literal syntax, for `decimal(0)`. Where `decimal` is a value type factory. Right - I meant what are the semantics of === applied to dissimilar, perhaps numeric, value types. ___ es-discuss mailing list es-discuss@mozilla.org

Re: Operator overloading for non-value objects

2014-01-14 Thread Kevin Smith
While opinions vary, the fact remains that == and = are in the language, are loose, and need to be overloadable for useful value objects, specifically more numeric types. I agree, that must be a goal of the design. Suggest you pull == out of your mental penalty box and look at it again.

Re: Operator overloading for non-value objects

2014-01-14 Thread Kevin Smith
So glad you asked, and you will like the answer: js 0L == 0 typein:2:0 TypeError: no operator function found for == ...and..I..do : ) http://goo.gl/N5txLJ - The strict equality operators, === and !==, cannot be overloaded - They work on frozen-by-definition value objects via a

Re: Operator overloading for non-value objects

2014-01-13 Thread Kevin Smith
Your point about it being too late to salvage == (vs. ===) is good, but perhaps with value objects plus further work to disable implicit conversions, == will make a come-back -- but that's far down the road. Work to disable implicit conversions? Can you clarify? I'm actually quite wary

Re: const VS features detection

2014-01-10 Thread Kevin Smith
No, what is required is (() = {...whatever...})() Arrow function expressions are an AssignmentExpression. Right, I misread Mark's code sample. ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: const VS features detection

2014-01-09 Thread Kevin Smith
I may warm up to the extra complexity more easily if somebody could present at least some compelling use cases. :) Mark's mention of yield got me thinking about await expressions. Hopefully I'm using this correctly: // stat is null or a Stat object const stat = do { try { await

Re: const VS features detection

2014-01-09 Thread Kevin Smith
I do have one usability concern with arrow IIFEs. I hate when I see them written as ()={...whatever...}() because you don't know that it's an IIFE until the end. Function expressions have the same issue. We should adapt Crock's recommended paren style to arrow IIFEs, to whit

const VS features detection

2014-01-08 Thread Kevin Smith
Since do-as-IIFE carries with it a subset of the semantics carried by do--as-block, I think it makes sense to proceed with the subset first, and expand if do-as-IIFE turns out to be surprising or lacking. IIUC, the goal here is to allow a sequence of statements to produce a value, not

Re: const VS features detection

2014-01-08 Thread Kevin Smith
If all you want is a non verbose IIFE, use an arrow function. We should consider do expressions only if they avoid the TCP violations of strict arrow IIFEs. One could say that they are verbose: var x = (_= { /* some statements, with a return statement somewhere */ })(); vs. var x =

Symbol.keyFor

2013-12-22 Thread Kevin Smith
In KeyKOS we used the word name. We had another meaning for the word key and wanted to avoid confusion. Name is good. Symbol.name(Symbol.for(foo)) === foo; Or some variant thereof. ___ es-discuss mailing list es-discuss@mozilla.org

Re: Symbol.keyFor

2013-12-22 Thread Kevin Smith
Name is good. Symbol.name(Symbol.for(foo)) === foo; Or some variant thereof. I like this, but it interferes with the name property that all function objects have—the Symbol.name property would no longer have the expected value Symbol. Oh yes - doh! : )

Re: Why thenables?

2013-12-21 Thread Kevin Smith
Can you leave what you feel is the best solution aside for a moment and comment on this proposal instead? Leave aside the best solution - NEVER!!! : ) 2-year old is bugging me, but I'll respond later... ___ es-discuss mailing list

Re: Why thenables?

2013-12-21 Thread Kevin Smith
By the way, I noticed that duck typing here is *already* not done with symbols. So the argument isn't its either going to be symbols or nothing. Its its either going to be symbols or the method then. That's right, and (digging a little deeper) there are two problems with using symbols: 1.

Why thenables?

2013-12-20 Thread Kevin Smith
I highly doubt that will be possible -- experience strongly suggests that every odd feature _will_ be relied on in the wild by that time. If we think thenable assimilation is a problem then we have to remove it now. I, for one, would welcome that. We could still provide an _explicit_ thenable

Re: Why thenables?

2013-12-20 Thread Kevin Smith
Presumably certain promise libraries would try reset the global Promise to AssimilatingPromise (or whatever) for full parity with polyfilled environments, which would be fine. If you're using modules, you wouldn't need to mess with the global object. You could just import

Re: Why thenables?

2013-12-20 Thread Kevin Smith
Here is code that breaks with that solution: ``` function createParser(code) { return {then: chainedTransformation = { ...; return this; } } } waitForFormSubmit() .then(e = $.get(getUrlFromUrlField())) .then(code = createParser(code, options)) ``` Not necessarily - if you're using new DOM

Re: Why thenables?

2013-12-20 Thread Kevin Smith
Hold on there. If they already do assimilation, why would you even inherit? So that the system will see jQuery's assimilating promises as real promises. So you're saying that promise library authors should rearchitect their entire libraries, and that solution is better than them just

Re: Reserving await within Arrow Functions

2013-12-12 Thread Kevin Smith
Banning await here is only a solution if you're also not going to ban an async descriptor on the arrow expression. THAT is the mistake. Not sure I follow - can you elaborate? What is an async descriptor on the arrow expression? ___ es-discuss

Re: Reserving await within Arrow Functions

2013-12-12 Thread Kevin Smith
=, *=, != =, =*, =! =, *, ! Which do you hate least? Hate is such a strong world... : ) My aesthetic judgement is that ! is not a good choice because grawl is bad for beginners. And async functions will touch beginners quite heavily (I predict). Btw, Kevin, I have read

Re: Reserving await within Arrow Functions

2013-12-12 Thread Kevin Smith
I think it's fairly self-evident that they are a natural fit for such use cases, but I find it less self-evident that they are inherently not useful for others (e.g., generators). I feel like I keep seeing the following (implied) argument: 1) Arrow functions are good for mappings 2)

Re: Reserving await within Arrow Functions

2013-12-12 Thread Kevin Smith
1) Non-mapping iteration (e.g., `forEach()`) 2) Lightweight callbacks Or, mappings to void. 3) Killing off 90% of `var self = this` occurrences. Here's is the iffy part. While getting rid of explicit this-binding is definitely a good thing, we want to make sure that goal fits in with

Re: Reserving await within Arrow Functions

2013-12-12 Thread Kevin Smith
p2 = p1 ! foo(a, b); would be equivalent to p2 = Promise.cast(p1).send(foo, a, b); which, for local promises, is equivalent to the ES6 p2 = Promise.cast(p1).then(r = r.foo(a, b)); Yes, but ! isn't agreed upon. By that time, we might be over our CoffeeScript-inspiration

Re: Reserving await within Arrow Functions

2013-12-12 Thread Kevin Smith
```js const concat = (a, b) =* { yield* a; yield* b; } ``` Thanks. For this particular example, it's no big deal to use longhand: function* concat(a, b) { yield* a; yield* b; } But you could throw a couple of `this`s in there and drive the argument that way. But are we going to see

Re: Reserving await within Arrow Functions

2013-12-12 Thread Kevin Smith
Well, let's use it in context then. I think this is correct? ```js const flattened = iterableReduce(iterableOfIterables, (a, b) =* { yield* a; yield* b; }, []); ``` Makes sense to me. Still, what's the alternative? function* concat(a, b) { yield* a; yield* b; } const flattened =

Reserving await within Arrow Functions

2013-12-11 Thread Kevin Smith
I think we should at least consider for a moment reserving `await` within the body of arrow functions. Consider the following event handling scenario, where lexical `this` is an important feature: this.button.on(click, $= { this.getDataAsync().then(data = {

Exporting a Module Instance Object

2013-12-09 Thread Kevin Smith
Is it possible to export a module instance object? module x from x; export { x }; I believe this should be allowed. I'm not aware of a technical reason why it shouldn't, and not allowing it would restrict some valid design options. For instance, within a package I might have a module

Re: “Arrow is not a replacement for all functions that want lexical this”

2013-12-09 Thread Kevin Smith
The point I was making in the meeting was that arrow functions are a syntactic convenience for a common case, not a general-purpose replacement for all functions that need to refer to an outer this-binding. They are not general-purpose because they don't support all the features of longhand

Export Default Sugarings

2013-12-05 Thread Kevin Smith
TLDR: We should consider deferring specialized syntax for exporting a default binding until after ES6. In the current draft, there are 3 ways to export a default binding: 1. Export a local binding with the name default: class Parser { ... } export { Parser as default }; 2. Use

Re: Export Default Sugarings

2013-12-05 Thread Kevin Smith
Good observation. However, if I were to simplify, I’d only keep #3. #1 and #2 look more syntactically questionable to me (kind of abusing names as keywords/markers). #1 is the base case because it is completely general. Any IdentifierName may appear in the as clause. export { x as

Re: Export Default Sugarings

2013-12-05 Thread Kevin Smith
#2 was removed at the hallway discussion of the face to face meeting. Do you still think we should remove #3? My only real issue with #3 is that it raises a footgun flag for me: export default function parse1JS(code) { // ... } parse1JS.foo = bar; // Surprise!

Re: Export Default Sugarings

2013-12-05 Thread Kevin Smith
Although the import side has this one extra syntactic special case for defaults: import x, {y as z, ...} from ... That seems really redundant. I assume mixing default import with others will be an extremely rare case, and when really needed, can easily be expressed as either import

Re: Generators Grammar and Yield

2013-12-02 Thread Kevin Smith
Jason suggests keeping the token stream and backing up. Another alternative is remembering the source position of the start of the parameter list and reparsing when the ambiguity and strictness is resolved. Whether text, token, or AST based reprocessing is better is an implementation

Re: Generators Grammar and Yield

2013-11-30 Thread Kevin Smith
This is no different from function f(x = function(y) { delete y }) { use strict; } It is in the sense that in the case you present, you already known by virtue of the function keyword that you are entering a maybe strict context. But I was able to program around it - not a huge deal.

Re: Generators Grammar and Yield

2013-11-29 Thread Kevin Smith
OK. One last question: I'm reading that the strictness of arrow functions is determined only the strictness of their enclosing context, and not by any prologues inside of them. True? x = { use strict; with (x) {} } // Not a strict-mode error ___

Re: Generators Grammar and Yield

2013-11-29 Thread Kevin Smith
x = { use strict; with (x) {} } // Not a strict-mode error Spec bug if so -- that should make the arrow function so stated have strict code. That would probably be the expectation, and I'm possibly just missing something in the spec. It does add an extra degree of complexity, though.

Re: Generators Grammar and Yield

2013-11-28 Thread Kevin Smith
function*(a = yield/b/g) { a = yield/b/g; } Why allow yield as an identifier in parameter defaults of generators? Wouldn't it be simpler just to disallow there as well? ___ es-discuss mailing list es-discuss@mozilla.org

Re: Generators Grammar and Yield

2013-11-28 Thread Kevin Smith
'yield' is already disallowed in generator function default initializer expressions (although I was reviewing the latest spec. revision yesterday and there may still be still bugs I have to fix in that regard). The reason it isn't allowed is that the generator object is not yet instantiated

Re: Generators Grammar and Yield

2013-11-26 Thread Kevin Smith
But IIRC (and from reading http://people.mozilla.org/~ jorendorff/es6-draft.html, looking for LetOrConst uses), ES6 supports let in all contexts, reserved word or not. Yes, I see that now. Has anyone done compatibility-hazard analysis for this breaking change? ; let[a].foo() //

Re: Generators Grammar and Yield

2013-11-26 Thread Kevin Smith
Implementation note: It is super obnoxious. +1 for adding that note to the spec : ) j/k It all just makes me wonder if we're better off saying: Forget the 'use strict' prologue, it's foobar. For strictness, use classes and modules instead. In no way am I trying to recall a sailed ship

Re: Generators Grammar and Yield

2013-11-26 Thread Kevin Smith
Thanks. I should have looked -- at this point es6-draft seems to have almost all of the wanted answers. Great work, keep going! Agreed, thank you Allen for bearing with me! ___ es-discuss mailing list es-discuss@mozilla.org

Generators Grammar and Yield

2013-11-25 Thread Kevin Smith
Apologies for this remedial question, but I find the new grammar parameterized around [Yield] to be confusing. If I understand correctly, this is to allow yield within non-strict generators. If that's correct, then why are non-strict generators a good idea? Thanks!

Re: Generators Grammar and Yield

2013-11-25 Thread Kevin Smith
function(a = yield+b) { use strict; } Ah, thanks for pointing out the function-head issue. So for non-strict regular functions, is yield allowed in parameter initializers or not? ___ es-discuss mailing list es-discuss@mozilla.org

Re: Generators Grammar and Yield

2013-11-25 Thread Kevin Smith
This makes for wtfjs additions, but they all seem non-wtf on reflection (or did to us when Waldemar threw them up on a whiteboard last week). By non-wtf, I mean anyone who groks that yield is reserved only in function* can work them out. The star after function really helps. ES5's use

Re: Generators Grammar and Yield

2013-11-25 Thread Kevin Smith
So we parse it as an identifier, just as we parse duplicate formal parameters. Then if we see use strict, we must post-process the parse tree and throw an error. Kind of a shame, but there it is. To use Waldemar's word, I wonder if that might get obnoxious: function(a = function(yield

Re: Generators Grammar and Yield

2013-11-25 Thread Kevin Smith
The handling of 'yield' in this case is no more obnoxious than any of the other strict mode restriction that apply to those functions that are defined in the parameter list. Agreed. My Homer Simpson joke was just trying to point out that (irrespective of `yield`, per se), post-validating

Re: Generators Grammar and Yield

2013-11-25 Thread Kevin Smith
Thanks Allen, this clears up the yield situation for me. ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Generators Grammar and Yield

2013-11-25 Thread Kevin Smith
The other option (I say this bracing for pain), is to avoid potential full-tree re-validation by applying strictness to parameter bindings only, and not to default expressions. This option might not be so bad if you consider that (a) code will gradually be moving into implicitly strict contexts

Re: Generators Grammar and Yield

2013-11-25 Thread Kevin Smith
Allen, What's the rationale for not making generator functions implicitly strict? Implicit strictness seems natural for new function forms, minus arrows. Looking forward, I have a hard time imagining that we'll want, say, async functions to be non-strict. I probably just missed some discussion

Re: Generators Grammar and Yield

2013-11-25 Thread Kevin Smith
The idea was to treat them as similarly to 'function' as possible, because * is such a small syntactic difference Makes sense, although on the other side you have a huge semantic difference, little refactoring hazard, and `yield` already reserved. Thanks again! -

Re: Generators Grammar and Yield

2013-11-25 Thread Kevin Smith
Validating default parameters against strict mode seems no worse in kind (if not degree) than validating parameter lists against duplicates was in ES5 days. Gross, but doable and I think better than leaving default expressions non-strict. Perhaps you're right. In addition to what we're

Re: Generators Grammar and Yield

2013-11-25 Thread Kevin Smith
Perhaps you're right. In addition to what we're doing already in ES5 and now ES6 destructuring patterns, I suppose you'd need to recurse into default expressions and look for any bad `delete` expressions, any WithStatements, and any bad BindingIdentifiers. And rinse and repeat with any

Error.name

2013-11-23 Thread Kevin Smith
I see that the Error constructor is designed to be subclassable. I can create simple error types like so: class ZenError extends Error {} let err = new ZenError(abc); However, I would expect that: err.name === ZenError; Such an expectation would be useful when determining how to

Try/catch conditional exceptions in light of generators

2013-11-21 Thread Kevin Smith
I think that the first of these has been established, there was a suggestion raised about the third and I have no idea about the fourth. I do however, admit that the patterns proposal doesn't sound to me like it has enough to solve this use case, or that I understand how the two are that

Re: Generator Arrow Functions

2013-11-16 Thread Kevin Smith
Heck, why not just add async functions to the agenda? There's: - Promises, yay - A well-establish use-case, which is awkward to implement without (as the original post demonstrates) - Strong syntactic precedent with C# - Strong semantic cowpath with TaskJS - Strong developer interest - A year to

Re: Generator Arrow Functions

2013-11-16 Thread Kevin Smith
- A year to work out any kinks : ) No, you're wrong -- I welcome correction as always, but I would appreciate being able to post to es-discuss without having to worry about this kind of backlash. Thanks. ___ es-discuss mailing list

Re: Generator Arrow Functions

2013-11-16 Thread Kevin Smith
Thanks - and thanks for pointing out the dependency on a scheduling specification. 3, for real. ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Generator Arrow Functions

2013-11-15 Thread Kevin Smith
From the examples I've seen so far in this discussion, it's likely that what is wanted isn't generator arrows, as much as syntactic support for asyc functions. Such a function, would, among other things, insure that all exceptions are converted to rejections, even exceptions occurring in the head

Re: Generator Arrow Functions

2013-11-15 Thread Kevin Smith
It would be great to have await, but in the meantime having generator functions would help male async methods tolerable. Await is ES7 at the earliest, generator arrow functions could be in ES6. Adding new features to ES6 at this point in time? I don't know... Besides, with async functions,

Re: Generator Arrow Functions

2013-11-15 Thread Kevin Smith
Basically, as long as the outermost generator is run by an async runner, both lazy and async execution of all nested generators/iterators is possible. Sure - it's the async runner part though (e.g. `spawn`), which is the use case presented here. async function F(p1, p2, ...pN) { /*...*/

ECMAScript Error Sink

2013-11-13 Thread Kevin Smith
Hi Mark, The only approximation that seems acceptable to me is one that (a) never has false negatives, and (b) provides a simple way for developers to receive notification on and fix false positives. Over in Dart they have implemented zones. http://api.dartlang.org/dart_async.html { zen }

Re: ECMAScript Error Sink

2013-11-13 Thread Kevin Smith
The only approximation that seems acceptable to me is one that (a) never has false negatives, and (b) provides a simple way for developers to receive notification on and fix false positives. Basic sysadmin stuff. To finish the thought, `done` and `WeakRefs` fail (a), and console-only

Promises and Decidability in Asynchronous Error Handling

2013-10-21 Thread Kevin Smith
A well-known problem with Promises, as implemented in various Javascript libraries, is that program errors are silenced by default. Consider the following program, which simply makes an HTTP request and then prints out the HTTP response headers:

Re: Promises and Decidability in Asynchronous Error Handling

2013-10-21 Thread Kevin Smith
Requiring early registration prevents the use of futures as value containers; i.e. kicking off an operation and storing the Future somewhere so anyone can use it at a later date. One can always do that, provided that you register an error handler *before your call stack is cleared*. { Kevin

Re: Promises and Decidability in Asynchronous Error Handling

2013-10-21 Thread Kevin Smith
Domenic, First, your caricature of my position is patently ridiculous. Second, can you or someone else offer a clear use case which requires undecidable error handling semantics? I have asked for examples several times and so far I haven't seen anything convincing. Usually that indicates that

Re: Promises and Decidability in Asynchronous Error Handling

2013-10-21 Thread Kevin Smith
It has been shown that delayed registration, in general, is useful. However, it has not been demonstrated that delayed registration of a primary error handler is necessary. If use cases have been provided, then please provide links. Otherwise, let's not use ad hominem in place of logic. {

Re: Scoped binding of a method to an object

2013-10-13 Thread Kevin Smith
This is trivial with Symbols: let shuffle = Symbol(); Array.prototype[shuffle] = function() {...}; Only code that has access to the `shuffle` symbol may use the method: let shuffled = array[shuffle](); Unfortunately, such a construction will fail in a multi-realm (i.e. multiple

Re: Generic Bundling

2013-10-10 Thread Kevin Smith
Side note (sorry): I missed that PDF the first time around, but from what I read it looks like good progress is being made. It feels like it's coming together. : ) { Kevin } ___ es-discuss mailing list es-discuss@mozilla.org

Re: Comments on Sept Meeting Notes

2013-09-30 Thread Kevin Smith
I think all we want here is make HTMLCollection interoperate better with other lists. For new features we moved away from HTMLCollection for the reason you mention. What do you think an HTMLCollection @@iterate method should do? Iterate like an array, or like a map? { Kevin }

Re: Comments on Sept Meeting Notes

2013-09-28 Thread Kevin Smith
I took Anne's cheeky lack of quotes around the div's id attribute to be just good HTML minimal style :-P. No extension there. In other words, I thought this was an argument against using @iterator to name the unstratified iteration protocol trap. Yes, it is - and it *might* be the

Re: Comments on Sept Meeting Notes

2013-09-28 Thread Kevin Smith
Anne, Would you agree that HTMLCollection is an inherently future-hostile API? That is, it is impossible to add *any* methods or properties to the API without potentially breaking compatibility? { Kevin } ___ es-discuss mailing list

Re: Comments on Sept Meeting Notes

2013-09-27 Thread Kevin Smith
Whether you personally use it, for-in is a reality. Introspection of objects happens, so if you ship a library that's putting meta-level properties into objects it needs to make them non-enumerable to be robust in the face of client code that uses for-in but isn't prepared to understand the

Re: Comments on Sept Meeting Notes

2013-09-27 Thread Kevin Smith
In this case I doubt @iterator or @toStringTag should be visible. (And I know there a better ways to test for empty objects, but for-in testing is common enough...) Thanks Andre! I fear this example merely begs the question of whether such an object should be considered empty with respect

Re: Comments on Sept Meeting Notes

2013-09-27 Thread Kevin Smith
All the noise we made about Object.extend was unclear? From jQuery: https://github.com/jquery/**jquery/blob/master/src/core.**js#L157https://github.com/jquery/jquery/blob/master/src/core.js#L157 Many similar functions, going back to Prototype's Object.extend: Object.extend =

Re: Comments on Sept Meeting Notes

2013-09-27 Thread Kevin Smith
div id=@iterator/div scriptalert(document.getElementsByTagName(div)[@iterator])/script This is a good point, and one which I was trying to reason about (way) upthread. This might do it - have to sleep on it, though... { Kevin } ___ es-discuss

Re: Comments on Sept Meeting Notes

2013-09-25 Thread Kevin Smith
I do not plan to switch to Map for string-keyed maps. I’ll be using `Object.create(null)` instead. Thanks, Domenic. I withdraw that aspect of the argument. I'm still not quite convinced that objects-as-maps make a truly isolated namespace necessary, however. I would be convinced by a code

Re: Comments on Sept Meeting Notes

2013-09-25 Thread Kevin Smith
You call namespaced strings more convenient than symbols, serves the purpose equally well. These two things are obviously not equivalent -- namespaced strings are obviously weaker. Obviously. I don't contend otherwise. I'm asking a different question: does their added strength justify the

Re: Comments on Sept Meeting Notes

2013-09-25 Thread Kevin Smith
I think that your example _might_ do it, although I'll have to think more about it tonight. If so, then the justification for symbols at this point is based on the dual use of JS objects as programming abstractions and as a key-value data structure. Oh, javascript... : ) { Kevin }

Re: [[Invoke]] and implicit method calls

2013-09-24 Thread Kevin Smith
A solution that works is better than one that doesn't. We always knew that patterns of proxies short of membranes would have abstraction leakage. This is one. What is wrong with the stance: Live with it or use membranes, I think I agree with this stance. Does that imply that we should drop

Re: [[Invoke]] and implicit method calls

2013-09-24 Thread Kevin Smith
The way I see it, `invoke` (as currently specified) introduces new, slightly incompatible function-call semantics, and doesn't really solve the problem of transparent forwarding to targets with private state. Better off without. { Kevin } ___

Re: [[Invoke]] and implicit method calls

2013-09-24 Thread Kevin Smith
I think this is a key point. Things like 'new Proxy(new Date, {}).getDate()' just don't work as expected with direct proxies and we have not been able to fix that while maintaining other important semantic requirements. If JS programmer have an expectation that they can usefully write such

Comments on Sept Meeting Notes

2013-09-24 Thread Kevin Smith
Thanks Rick, for writing up these meeting notes once again. Some comments: ## Symbols ## As it currently stands, the only thing that symbols provide is an isolated namespace for meta-level property keys. This assures us that arbitrary string keys will not collide with any meta-level property

Re: Comments on Sept Meeting Notes

2013-09-24 Thread Kevin Smith
This seems like a non-sequitur. Symbols aren't meant to help with the object as map use-case, and even if you tried to, they work terribly for it. They're meant for the add an actual property/method without collision use-case. Again, Maps seem like a non-sequitur here - using a Map doesn't

Re: Comments on Sept Meeting Notes

2013-09-24 Thread Kevin Smith
Now, one might argue that using the string std:iterator (or equivalent) would present a backward compatibility hazard for legacy code using objects as maps. I'll have to think about that one... Problem is polyfillability, and Map polyfill with O(n^2) complexity is a loser in general.

Re: [[Invoke]] and implicit method calls

2013-09-23 Thread Kevin Smith
Hi Allen, Your line of thinking has convinced me that `invoke` as it currently stands doesn't really fly. However, I have an issue with your proposal. Take this fragment: (1) function f() { doSomethingWith(this); } (2) f.call(obj); Presently, the expression at (2) grants the function

Re: [[Invoke]] and implicit method calls

2013-09-22 Thread Kevin Smith
I've been only loosely following this thread, but I think Allen's proposal has merit. If I understand correctly, it is extremely simple: provide proxies with a hook into [[Call]], based on the `this` value. { Kevin } ___ es-discuss mailing list

Re: Promises: final steps

2013-09-05 Thread Kevin Smith
Hi Kris, Thanks for the details! This gives us an idea what a promise monitoring feature might look like in a browser's developer tools. I think such a feature would be really cool, but I believe that promise-using programs ought to be debuggable using just a console. Indeed, for a non-GUI

Re: Promises: final steps

2013-09-05 Thread Kevin Smith
It's not clear to me why this, or your `Promise.throw`, is better than ```js somePromise.done(...) // or somePromise.then(...).done() ``` Not *much* better, I'd say, but IMO a `done` method which accepts a callback overlaps too much with `then`, and a `done` method without a callback just

<    1   2   3   4   5   6   7   8   9   10   >