Re: Some questions about Private Name Objects

2012-08-27 Thread Axel Rauschmayer
t; > myClass.prototype.getTest = function() { return this[test] } > > Is the above perfectly valid? No, ES.next would complain about the undeclared variable `test` (variable scope, not object). The closest you can get to simulating is by using strings with UUIDs. That avoids t

Re: Some questions about Private Name Objects

2012-08-27 Thread Axel Rauschmayer
compiling into ES3/5 you could get away > with not attaching some .__privates__ property to the object and instead just > put a closure around the definitions. > > Thanks ahead of time! > > Matthew Robb > _______ > es-discuss maili

Re: "var" declarations shadowing properties from Window.prototype

2012-08-15 Thread Axel Rauschmayer
os(obj) { var chain = []; while (obj) { chain.push(obj); obj = Object.getPrototypeOf(obj); } return chain; } Axel -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com __

Re: strawman for the := operator

2012-08-09 Thread Axel Rauschmayer
easily. > > You beat me to it! Programs of even moderate size and complexity require > abstraction. Arguably that's what real programmers do. If "library author" > means "abstraction creators" then those are exactly the people we want to > better supp

Re: strawman for the := operator

2012-08-09 Thread Axel Rauschmayer
post as not at all that strong as it may > look. Those names are not important, what matters is the list of use cases and their analysis. Do you only disagree with the names or also with the analysis? There are some things that normal developers never do, for example: patching built-ins.

Re: strawman for the := operator

2012-08-09 Thread Axel Rauschmayer
has taken on some of definition’s responsibilities. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: strawman for the := operator

2012-08-09 Thread Axel Rauschmayer
Those are the labels that can be used e.g. with break and continue. Not names of properties in an object literal. [[[Sent from a mobile device. Please forgive brevity and typos.]]] Dr. Axel Rauschmayer a...@rauschma.de Home: http://rauschma.de Blog: http://2ality.com On 09.08.2012, at 20:15

Re: strawman for the := operator

2012-08-08 Thread Axel Rauschmayer
we are missing the clarity that we have with variables: You can’t assign to an undeclared variable (in strict mode). With properties, assignment “auto-declares” if there is no own property and no setter. So things are less clear. -- Dr. Axel Rauschmayer a...@rauschma.de home

Re: strawman for the := operator

2012-08-08 Thread Axel Rauschmayer
Or are there other common pitfalls? -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: strawman for the := operator

2012-08-08 Thread Axel Rauschmayer
one? 1 would be the default, 0 or -1 could be used for: “the complete prototype chain”. Loosely related: I recently looked at _.extend and was surprised that it didn’t copy non-enumerable properties (as far as I can tell, impossible pre ES5) and that it included all inherited properties. OTOH, if

Re: strawman for the := operator

2012-08-08 Thread Axel Rauschmayer
structors put all instance data in the same object, so you already have an automatic flattening. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: What’s the best name for keyword parameters?

2012-08-06 Thread Axel Rauschmayer
to es-discuss. I stick to spec terminology as much as possible, but some things are beyond the scope of the spec (such as IIFE). Then I just want to make sure that there isn’t something good already in use before I make up my own words. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de tw

Re: Object.defineMethod()?

2012-08-06 Thread Axel Rauschmayer
Makes sense! Thanks! On Aug 6, 2012, at 23:29 , Brendan Eich wrote: > Rick Waldron wrote: >> On Monday, August 6, 2012 at 4:18 PM, Axel Rauschmayer wrote: >>> Will that function still be added, or will its work (setting up [[Home]] >>> and [[MethodName]]) be done v

Re: Terminology: named data properties

2012-08-06 Thread Axel Rauschmayer
may be taken to mean "primitive, > not reference (object)." Got it. Wanted to avoid NIH in my writings, but will try my best to keep my own terminology consistent. I thought value objects came from “compare by value”, but then I am still making Rick’s point. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: What’s the best name for keyword parameters?

2012-08-06 Thread Axel Rauschmayer
for >> the term IIFE. > Ben Alman coined this, not the spec. You are making my point! Or are you saying that this kind of discussion (not *directly* related to the spec) is off-topic? But where else can you discuss this? -- Dr. Axel Rausch

Re: Terminology: named data properties

2012-08-06 Thread Axel Rauschmayer
scalar, whereas "data" is accurately vague. My understanding: - Method: a property whose value is a function. - Data property: a property that is not a method or an accessor (getter, setter). Example: “ES.next classes don’t let you directly create data properties in prototypes”. - Value

Object.defineMethod()?

2012-08-06 Thread Axel Rauschmayer
Will that function still be added, or will its work (setting up [[Home]] and [[MethodName]]) be done via Object.defineProperty? I couldn’t find anything in the draft. Axel -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com

Re: What’s the best name for keyword parameters?

2012-08-06 Thread Axel Rauschmayer
term IIFE. On Aug 3, 2012, at 10:34 , Alex Russell wrote: > There is a long history of TC39 naming things for internal use and those > names never escaping to the common lexicon. I'm not sure it's a thing we need > to (or even should) weigh in on via the spec. -- Dr.

Terminology: named data properties

2012-08-06 Thread Axel Rauschmayer
On es-discuss, I’ve seen the term “data properties” used for named data properties that are not methods. In this light: wouldn’t it be better to rename named data properties to named value properties? -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma

Re: Template strings and templates

2012-08-05 Thread Axel Rauschmayer
is is a generic DSL embedding mechanism, where you can > escape back into the host language from holes in the guest language. The > thing to the left of the first backquote, more than anything else names the > guest language being embedded. (FWIW, in E we call in It the quasiparser

Re: Setting up (non-index) properties of arrays

2012-08-04 Thread Axel Rauschmayer
ki.ecmascript.org/doku.php?id=strawman:dicts > > /be > > Axel Rauschmayer wrote: >> As an example, a template string call site ID would be constructed as >> follows: >> >>const callSiteId1234 = do { >>let literalParts = ['lit1\n&

Re: (Mostly) blocked from es-discuss

2012-08-04 Thread Axel Rauschmayer
> On Aug 2, 2012, at 4:08 PM, Axel Rauschmayer wrote: > >> Lately, the es-discuss filter has been very picky about my emails: 3 out of >> 5 were rejected in recent weeks and are still held up somewhere. >> >> What can I do? Even telling es-discuss-owner@… about it doesn’

Re: (Mostly) blocked from es-discuss

2012-08-04 Thread Axel Rauschmayer
Thanks. Will try to avoid the words Viagra and casino in my posts. ;-) On Aug 3, 2012, at 6:45 , Brendan Eich wrote: > Trying to whitelist you. Your posts look like spam to postini! > > /be -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/raus

Setting up (non-index) properties of arrays

2012-08-04 Thread Axel Rauschmayer
rts }; How about the following abbreviation? const callSiteId1234 = ['lit1\n', ' lit2 ', '', raw: ['lit1\\n', ' lit2 ', '']]; Not sure it’s a frequent-enough use case, though. Mustache would be nice here, or one could use

Re: class Foo {}

2012-08-04 Thread Axel Rauschmayer
On Jul 29, 2012, at 6:09 , Brendan Eich wrote: > Axel Rauschmayer wrote: >> A case could be made that Foo.[[prototype]] should be Object and not >> Function.prototype. Then the prototype hierarchies of classes and their >> prototypes would be fully symmetric. The reason

Re: Template strings and templates

2012-08-03 Thread Axel Rauschmayer
r". > > However, in talking about the syntactic forms it seems awkward to say "a > template string with a handler" or a "handled template string". In those > situations it may flow better to refer to the expression that provides the > handler value

Re: Template strings and templates

2012-08-03 Thread Axel Rauschmayer
plate" to emphasize that it was a > template that was expressed as a string rather than a template for a string. > That may be too subtle of a distinction. At the TC39 there were some > concerns that simply "template" was too general and might cause confusion > relativ

Re: Template strings and templates

2012-08-03 Thread Axel Rauschmayer
to this approach. Nice. I’d let the html handler do the join, then it’s even shorter. That is: If a substitution is an array of strings, it joins, otherwise it coerces to string. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com _

Re: Moving String.prototype.substr to normative part of the spec

2012-08-03 Thread Axel Rauschmayer
om/g_marty/status/231404856492036096 > [2] https://twitter.com/mathias/status/231418712580845568 > [3] http://kangax.github.com/es5-compat-table/non-standard/ > ___ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.moz

Re: What’s the best name for keyword parameters?

2012-08-02 Thread Axel Rauschmayer
word" is not the right word. Suggestions for better terms welcome. Property parameters? Inside a parameter object? > Named parameters were part of original ES4/JS2: > > http://web.archive.org/web/20030216220908/http://www.mozilla.org/js/language/js20-2002-04/core/functions.html#param

(Mostly) blocked from es-discuss

2012-08-02 Thread Axel Rauschmayer
Lately, the es-discuss filter has been very picky about my emails: 3 out of 5 were rejected in recent weeks and are still held up somewhere. What can I do? Even telling es-discuss-owner@… about it doesn’t seem to work, any more. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de

What’s the best name for keyword parameters?

2012-08-02 Thread Axel Rauschmayer
/2011/11/keyword-parameters.html -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Template strings and templates

2012-08-02 Thread Axel Rauschmayer
f the ES.next parser handling nesting for you. [1] http://www.nczonline.net/blog/2012/08/01/a-critical-review-of-ecmascript-6-quasi-literals/ -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-dis

Re: July 25, 2012 - TC39 Meeting Notes

2012-08-02 Thread Axel Rauschmayer
eless it's hard to find > time to write the rest. > > On Thu, Aug 2, 2012 at 4:02 PM, Axel Rauschmayer wrote: >> What’s the best material for reading up on the “override mistake”? >> This? >> http://wiki.ecmascript.org/doku.php?id=strawman:fixing_override_mistak

Re: July 25, 2012 - TC39 Meeting Notes

2012-08-02 Thread Axel Rauschmayer
o remain unchanged in this regard. > > > -- >Cheers, >--MarkM > ___ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -- Dr. Axel Rausch

class Foo {}

2012-07-28 Thread Axel Rauschmayer
A case could be made that Foo.[[prototype]] should be Object and not Function.prototype. Then the prototype hierarchies of classes and their prototypes would be fully symmetric. The reason that isn’t done is so that a class is an instance of Function, right? Axel -- Dr. Axel Rauschmayer a

Re: JSON.stringify(undefined)

2012-07-16 Thread Axel Rauschmayer
t;{}". Perhaps JSON.stringify(undefined) should, however, return "" -- in my > view, this would make more sense. > > On 16/07/12 10:48, Axel Rauschmayer wrote: >> ... returns undefined. Shouldn’t it be "undefined"? >> >> -- >> Dr. Axel Ra

JSON.stringify(undefined)

2012-07-15 Thread Axel Rauschmayer
... returns undefined. Shouldn’t it be "undefined"? -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/l

Re: "delay" keyword

2012-07-04 Thread Axel Rauschmayer
s as much as you want! :) > > ___ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss -- Dr. Axel Rauschmayer a...@rauschma.de twitter.com/rauschma Home: rauschma.de Blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: ES Modules: suggestions for improvement

2012-06-30 Thread Axel Rauschmayer
Right. :-) There is indeed some clever module stuff out there. IIRC, Racket, née PLT Scheme, goes even further than ML. Newspeak is interesting, too. [[[Sent from a mobile device. Please forgive brevity and typos.]]] Dr. Axel Rauschmayer a...@rauschma.de Home: http://rauschma.de Blog: http

Re: ES Modules: suggestions for improvement

2012-06-29 Thread Axel Rauschmayer
ork around not having functions (via static methods), a bit like JSON, Math, et al. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://ma

Re: ||= is much needed?

2012-06-12 Thread Axel Rauschmayer
side (at the callsite) much, in my > experience. Dave may be seeing other sources, but it's extremely rare in my > experience to see > > foo(arg1 || callers_idea_of_default_arg1_value); -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/

Re: New Object Extension Literal Strawman

2012-05-30 Thread Axel Rauschmayer
>> I was mostly concerned about concise methods. > > For most cases, you just want [[Put]]. And I favor thin arrow for concise > standalone methods/constructors. How about the following use case? Adding a method with a super-reference to an existing object. -- Dr. Axe

Re: New Object Extension Literal Strawman

2012-05-29 Thread Axel Rauschmayer
o :, but with [[Put]]. -- Dr. Axel Rauschmayer a...@rauschma.de twitter.com/rauschma Home: rauschma.de Blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: TC39 meeting Wed 5/23/2012

2012-05-28 Thread Axel Rauschmayer
vaScript how it should be”. So there must be a rationale behind making it fail silently in non-strict mode. I personally don’t mind too much, because the object is frozen either way, things just fail much later in non-strict mode. -- Dr. Axel Rauschmayer a...@rauschma.de twitter.com/rauschma

Re: Arity checking?

2012-05-25 Thread Axel Rauschmayer
> Axel Rauschmayer wrote: >> I was under the impression that ECMAScript.next was going to perform arity >> checking. But looking at the proposals and the draft spec, it doesn’t look >> like it. > > How would that work? It's impossible under 1JS. > >> I

Re: announcing normative ECMAScript specification in HTML

2012-05-25 Thread Axel Rauschmayer
rgive brevity and typos.]]] Dr. Axel Rauschmayer a...@rauschma.de Home: http://rauschma.de Blog: http://2ality.com On 24.05.2012, at 19:58, Allen Wirfs-Brock wrote: > Ecma International now hosts a normative HTML copy of Ecma-262, Edition 5.1 > The ECMAScript Language Specification. T

Arity checking?

2012-05-25 Thread Axel Rauschmayer
perform arity checking only in the presence of parameter default values and/or rest parameters. Conditionally switching it on (e.g. via a pragma) does seem an option, though. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com

Re: const classes for max/min

2012-05-25 Thread Axel Rauschmayer
hink it is up to Waldemar and supporters of his > requirements to come up with concrete proposals how these things can > fit into ECMAScript. (Thanks Russel for starting this thread.) -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Array.prototype.take

2012-05-24 Thread Axel Rauschmayer
g to push them into another array. > > > Regards > -- > Irakli Gozalishvili > Web: http://www.jeditoolkit.com/ > > On Thursday, 2012-05-24 at 18:00 , Axel Rauschmayer wrote: > >> On May 25, 2012, at 2:42 , Irakli Gozalishvili wrote: >> >>> At the m

Re: Array.prototype.take

2012-05-24 Thread Axel Rauschmayer
lans for a module of iterator tools. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: const classes for max/min

2012-05-24 Thread Axel Rauschmayer
would be non-writable, but data would be. As I indicated, > private names can be used to protect against unwanted mutation. What function (or equivalent operation) would [[Construct]] apply to an instance after initialization? Object.seal() or Object.freeze()? -- Dr. Axel Rauschmayer a...@rau

Re: const classes for max/min

2012-05-24 Thread Axel Rauschmayer
minimal impact, and does not > affect future friendliness. Other additions like private properties and > static methods, for example, would easily fit before ES6 is finalized or as a > future. enhancement. > > - Russ > ___ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Subclassing ECMAScript arrays with Array.create(arrayPrototypeObject)

2012-05-21 Thread Axel Rauschmayer
Maybe there is a ES.next feature which allows subclassing javascript arrays > in another way then mentioned above? > > Regards, > > Henri > > ___ > es-discuss mailing list > es-discuss@mozilla.org > https://ma

Re: WeakMaps functionality, within regular object semantics

2012-05-21 Thread Axel Rauschmayer
: > The "weak reference" semantics needs to apply to the entire collection in > order to avoid key/value circularity induced leaks > ___ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo

Re: The new operator

2012-05-13 Thread Axel Rauschmayer
pushing low-level JS performance and language > extensions! I like that they can be introduced in a stepwise fashion (whenever that may be...): Numbers first, user-defined value object types later. Numbers should complement the binary data proposal nicely. -- Dr. Axel Rauschmayer a...@rau

Re: The new operator

2012-05-13 Thread Axel Rauschmayer
and always use semicolons. And they can afford to initially ignore == and always use ===. I use such rules for myself, too. It allows me to stay sane w.r.t. to some of the details. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com __

Re: The new operator

2012-05-13 Thread Axel Rauschmayer
. "number" 5. "string" 6. "value object" 7. "reference object" That would cover my use cases. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: The new operator

2012-05-13 Thread Axel Rauschmayer
> Axel Rauschmayer wrote: >> Until ES.next, I’ve stuck to the simple rule: Always use `new` when you want >> to create an instance. That avoids confusion when it comes to functions such >> as String and Boolean: I like using them to coerce values. > User-defined constru

The new operator

2012-05-13 Thread Axel Rauschmayer
” it. - Should there be alternate, possibly less confusing, ways of coercing values? ToPrimitive() would certainly be nice to have. Axel -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es

Re: Recursion in generators?

2012-05-10 Thread Axel Rauschmayer
); } } Tree.prototype[iterator] = iter; On May 10, 2012, at 23:22 , Erik Arvidsson wrote: > On Thu, May 10, 2012 at 2:16 PM, Axel Rauschmayer wrote: >> function* iter() { >> >> if (this.left) { >> >> yield* iter(this.left); > > I'm con

Re: Recursion in generators?

2012-05-10 Thread Axel Rauschmayer
if (this.left) { >> yield* iter(this.left); >> } >> yield this.label; >> if (this.right) { >> yield* iter(this.right); >> } >> } >> >> Tree.prototype.visit = visit; >> Tree.prototype[itera

Re: Recursion in generators?

2012-05-10 Thread Axel Rauschmayer
* iterGen(this.right); } } Tree.prototype.visit = visit; Tree.prototype[iterator] = iterate; On May 10, 2012, at 21:32 , Brendan Eich wrote: > Jason Orendorff wrote: >> On Wed, May 9, 2012 at 2:07 AM, Axel Rauschmayer wrote: >>> Nice. It took me a few moments to

Re: typeof null

2012-05-09 Thread Axel Rauschmayer
would like to understand other real use cases > where cross-frame type testing is needed. Does anybody have any? -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: TC39 bashing

2012-05-09 Thread Axel Rauschmayer
(underscore) or build something new. > > [...] > > -Mikeal > > On May 9, 2012, at May 9, 20124:46 PM, Axel Rauschmayer wrote: > >> I’m seeing quite a bit of anti-TC39 sentiment out there and I don’t think >> it’s fair. Some examples (paraphrasing): >> >

Re: typeof null

2012-05-09 Thread Axel Rauschmayer
modules change anything? Are module instances shared between windows? Will there be a unique way of identifying types? Are there any other ideas for making the cross-window situation simpler? -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.

TC39 bashing

2012-05-09 Thread Axel Rauschmayer
strategy for doing so, but I’d love to read more about it. Axel -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org

Re: typeof null

2012-05-09 Thread Axel Rauschmayer
ally, one could throw an exception if there is an instanceof check whose lhs and rhs are from different contexts (failing fast, preventing obscure and hard-to-debug errors). -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Recursion in generators?

2012-05-09 Thread Axel Rauschmayer
makes sense: this.left.@iterator() On May 9, 2012, at 5:02 , Erik Arvidsson wrote: > On Tue, May 8, 2012 at 4:24 PM, Axel Rauschmayer wrote: >> Cool. Like this? > > Yup. > > http://code.google.com/p/traceur-compiler/source/browse/test/feature/Yield/Tree.js#13 > >

Re: typeof null

2012-05-08 Thread Axel Rauschmayer
e “new typeof” is to be about classifying primitives and distinguishing primitive values from objects then I would make it return "object" for all non-primitive values (including functions). -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma

Re: typeof null

2012-05-08 Thread Axel Rauschmayer
both. Or do you propose returning functions for objects and strings for primitives? E.g.: switch(type(x)) { case "null": // x is null ... break; case "string": // typeof x === "string" ... break; case String: // x instanc

Re: Recursion in generators?

2012-05-08 Thread Axel Rauschmayer
012, at 1:20 , Erik Arvidsson wrote: > You can use yield* here. > > On May 8, 2012 4:12 PM, "Axel Rauschmayer" wrote: > The following generator produces an iterator for nested arrays. Is this the > best way to do recursion? Doesn’t seem terribly elegant. > >func

Recursion in generators?

2012-05-08 Thread Axel Rauschmayer
ext() [object StopIteration] -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: typeof null

2012-05-08 Thread Axel Rauschmayer
could pretty easily add a new library function: > > import type from "@std"; > console.log(type(null)) // "null" > > I'd support that. > > Dave > > ___

Re: typeof null

2012-05-08 Thread Axel Rauschmayer
something like this even possible? > > Rick > > ___ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/raus

Re: ES6 global environment configuration proposal

2012-05-04 Thread Axel Rauschmayer
>global object properties are only be created via explicit reference to > global this > >No Global Object > Global object is undefined > all ES top level declarations (including var/function) create binding > in Top Lex > > > Thoughts? I

Re: Thousand separator in numeric type literals

2012-04-30 Thread Axel Rauschmayer
> Biju > ___ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com

Re: Bound instance-function vending (was RE: Arrow binding)

2012-04-29 Thread Axel Rauschmayer
need a way to declare whether an argument is expected to have dynamic or lexical this. Possibly On Apr 29, 2012, at 20:01 , Brendan Eich wrote: > If so then there is no need for any isArrowFunction or > isFunctionThatBindsOrIgnoresThis predicate. > > /be > > Axel Rauschma

Re: Bound instance-function vending (was RE: Arrow binding)

2012-04-29 Thread Axel Rauschmayer
ard not > to picture chaos. (and how do you shim => anyway?) Right. I think you can still tell a simple story to beginners while supporting thin arrow or (this, ...) => {} for legacy software. But I’d hope that the old code can be cleanly separated and that a new coding style will be supp

Re: Bound instance-function vending (was RE: Arrow binding)

2012-04-29 Thread Axel Rauschmayer
With “rules”, I don’t mean rules in the sense of the language spec, but rather rules for teaching the language to newcomers. On Apr 29, 2012, at 10:28 , Brendan Eich wrote: > Axel Rauschmayer wrote: >> I am not saying that the transition from the old rules to the new rules will >&

Re: Bound instance-function vending (was RE: Arrow binding)

2012-04-28 Thread Axel Rauschmayer
Correction: Some code such as `forEach` implementations that previously needed to use `call` to simulate lexical scoping don’t need the `thisValue` parameter for arrow [was: array] functions. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog

Re: Bound instance-function vending (was RE: Arrow binding)

2012-04-28 Thread Axel Rauschmayer
IMHO. Library code might need to go to extra lengths to help normal developers with the transition (error messages, different behavior, tool functions, etc.) and – to be explicit – might need a predicate such as `isArrowFunction` (which should only ever be used under the hood and thus would not in

Re: Arrow binding

2012-04-24 Thread Axel Rauschmayer
: > > On Apr 24, 2012, at 3:30 PM, Axel Rauschmayer wrote: > >>> B. add expression bodies to method shorthands, don't add skinny arrow >>> >>>(-) Loses the flexibility of shorthand syntax for assigning to an >>> existing objec

Re: Arrow binding

2012-04-24 Thread Axel Rauschmayer
? You’d have to invoke a defineMethod() somewhere along the way. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Arrow binding

2012-04-24 Thread Axel Rauschmayer
box() this._value, setbox(v) this._value = v } -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Arrow binding

2012-04-24 Thread Axel Rauschmayer
is easily confused. > > Hope that helps > > Rick > > > > > > ~TJ > ___ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-dis

Re: Arrow binding

2012-04-23 Thread Axel Rauschmayer
thod() invokes the actual method. Hence, in addition to getters and setters, we would have "callers". If a property doesn’t have a caller then obj.method() would first invoke the getter and then try to call the result. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twit

Re: A few arrow function specification issues

2012-04-21 Thread Axel Rauschmayer
> Using `=>` but being forced to using `function` anytime I want dynamic this > just doesn't work. That may be the crux of the matter. I’d say: In new code, use a method definition any time you want dynamic `this`. In old code, use a function expression. -- Dr. Axel

Re: A few arrow function specification issues

2012-04-21 Thread Axel Rauschmayer
functions) and method definitions (methods), one > will automatically do the right thing. > > Thats three types of functions now. Our legacy code is going to be confused. A definite possibility. However, the only problem I can see is a function expecting to pass `this` to a

Re: A few arrow function specification issues

2012-04-21 Thread Axel Rauschmayer
> On Sat, Apr 21, 2012 at 1:56 PM, Axel Rauschmayer wrote: > Counter-question: Isn’t it clear when you create a function whether it is > going to be a non-method function or a method? > > It's clear to the implementer - Its not clear to a function that gets it as &g

Re: A few arrow function specification issues

2012-04-21 Thread Axel Rauschmayer
ut then you need to convert it to a non-method function, anyway (e.g. via bind()). -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: A few arrow function specification issues

2012-04-21 Thread Axel Rauschmayer
this = undefined is bearable for old-school non-method functions, but switching to lexical this will lead to many hard-to-debug errors. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___

Re: callable objects ?

2012-04-17 Thread Axel Rauschmayer
bjects @call and > @construct properties. > > This also simplifies direct proxies by allowing any proxy to have call and > construct traps. > > Comments welcome. > > /be > ___ > es-discuss mailing list >

Re: Terminology: “non-method function”

2012-04-13 Thread Axel Rauschmayer
> On Tue, Apr 10, 2012 at 4:01 PM, Axel Rauschmayer wrote: > What is a good term for functions that don’t have/use dynamic `this`? > “Non-method function” defines them by what they aren’t, I would like a > positive definition. I’ve considered the term “pure function”, but the >

Re: Methods: automatic binding on read?

2012-04-13 Thread Axel Rauschmayer
function myDefineMethod(obj, propName, func) { Object.defineProperty(obj, propName, { get: function () { // TODO: memoization return func.bind(this); }, invoke: func }); } This might clash with the proxy protocol and

Re: undefined being treated as a missing optional argument

2012-04-13 Thread Axel Rauschmayer
ertain amount of purity and > correctness to it, I just don't think its practical. > > - Russ > > > Allen > > > _______ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss -- Dr. Axel Rauschmayer a...@rauschma.d

Methods: automatic binding on read?

2012-04-13 Thread Axel Rauschmayer
notation: - Read: bind `this` - Write: apply defineMethod to the argument (not sure about this one) - Call: same as before I have no idea how this would fit into the current semantics, so it might be a silly idea, but it would eliminate a common source of bugs. -- Dr. Axel Rauschmayer a

Re: Terminology: “non-method function”

2012-04-11 Thread Axel Rauschmayer
being derived from “partial application”. On Apr 11, 2012, at 18:44 , Allen Wirfs-Brock wrote: > > On Apr 11, 2012, at 7:12 AM, Peter van der Zee wrote: > >> On Wed, Apr 11, 2012 at 1:01 AM, Axel Rauschmayer wrote: >>> What is a good term for functions that don’

Re: Terminology: “non-method function”

2012-04-11 Thread Axel Rauschmayer
On Apr 11, 2012, at 12:37 , Alex Russell wrote: > On Apr 11, 2012, at 1:02 AM, Allen Wirfs-Brock wrote: > >> On Apr 10, 2012, at 4:01 PM, Axel Rauschmayer wrote: >> >>> What is a good term for functions that don’t have/use dynamic `this`? >>> “Non-method

Re: Terminology: “non-method function”

2012-04-10 Thread Axel Rauschmayer
object > - Method: A function that has a dynamic this (or super) dependency. > - Callback: A function that does not have a dynamic this dependency. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___

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