Re: More fun with undefined

2012-06-15 Thread T.J. Crowder
On 15 June 2012 07:42, Herby Vojčík he...@mailbox.sk wrote: T.J. Crowder wrote: Making a point of making this a separate thread from the current ?? and ??= thread(s), which are thankfully looking close to consensus. So that's infix and assignment. Question: Should we consider unary as

Re: More fun with undefined

2012-06-15 Thread Andreas Rossberg
On 15 June 2012 01:22, Allen Wirfs-Brock al...@wirfs-brock.com wrote: A wonder if this wart is hairy enough, that we wouldn't be justified in some explicit backwards compatibility hackery in the spec. to remove it. For example, we could allow it to appear in parameter lists and provide a

Re: More fun with undefined

2012-06-15 Thread Herby Vojčík
T.J. Crowder wrote: On 15 June 2012 07:42, Herby Vojčík he...@mailbox.sk mailto:he...@mailbox.sk wrote: T.J. Crowder wrote: Making a point of making this a separate thread from the current ?? and ??= thread(s), which are thankfully looking close to consensus. So

Re: More fun with undefined

2012-06-15 Thread T.J. Crowder
On 15 June 2012 08:09, Andreas Rossberg rossb...@google.com wrote: On 15 June 2012 01:22, Allen Wirfs-Brock al...@wirfs-brock.com wrote: A wonder if this wart is hairy enough, that we wouldn't be justified in some explicit backwards compatibility hackery in the spec. to remove it. For

Re: ||= is much needed?

2012-06-15 Thread Aymeric Vitte
Yes, what I mean is that I did not see since a long time something like a===null?b:c or if (a===null)||b, and except for specific use like Object.create(null) I don't see a lot of null being used, then making the distinction for ??, ?: and others looks too subtle Le 15/06/2012 04:20, Brendan

Re: More fun with undefined

2012-06-15 Thread Brendan Eich
This isn't unrelated. If we do get patterns into Harmony they may subsume some of the postfix-?? (which does not work syntactically, IMHO) or prefix-? ideas. Or at least prefix-? may show up in the pattern language (dherman and I have discussed it). Syntax design requries global oversight,

Re: More fun with undefined

2012-06-15 Thread T.J. Crowder
On 15 June 2012 12:41, Brendan Eich bren...@mozilla.com wrote: This isn't unrelated. If we do get patterns into Harmony they may subsume some of the postfix-?? (which does not work syntactically, IMHO) or prefix-? ideas. Or at least prefix-? may show up in the pattern language (dherman and I

Re: Default operator strawman - ||| rather than ??

2012-06-15 Thread T.J. Crowder
I think the original thrust of this thread may have got lost a bit in the (useful) discussion of null and undefined, so coming back to the original point: On 12 June 2012 16:29, T.J. Crowder t...@crowdersoftware.com wrote: In the current default operator strawman[1], the operator is ??, e.g.:

Re: More fun with undefined

2012-06-15 Thread Aymeric Vitte
Probably there are very good reasons but I reask the question : why should the attempt to access a property of a variable equal to undefined global property not return undefined global property ? (ie a way that this works : if (a.b.c.d) {} when a,a.b, etc are not set) This can be usefull when

Re: More fun with undefined

2012-06-15 Thread T.J. Crowder
On 15 June 2012 14:34, Aymeric Vitte vitteayme...@gmail.com wrote: Example : console.log(a);//Reference error, GetBase returns undefined console.log(window.a);//undefined -- does not seem very logical, no ? To me this would be a big step backward, after the very large stride forward this

Re: More fun with undefined

2012-06-15 Thread Aymeric Vitte
I am not talking about defining implicit properties or such things, neither having undeclared stuff looking declared, but just changing the behavior of retrieving a property when base is undefined, which will then be undefined. If am I reading correctly the specs, doing this change will work

Re: More fun with undefined

2012-06-15 Thread T.J. Crowder
On 15 June 2012 15:34, Aymeric Vitte vitteayme...@gmail.com wrote: I am not talking about defining implicit properties or such things, neither having undeclared stuff looking declared, but just changing the behavior of retrieving a property when base is undefined, which will then be

Re: RegExp.escape()

2012-06-15 Thread T.J. Crowder
On 23 March 2012 12:12, Steven Levithan wrote: Erik Corry wrote: In perl the recommended version is text.replace(/([^a-zA-Z0-9])/g, \\$1) which is future-proof and safe and I think this also works for JS. It's probably future-proof and safe, but it escapes 65,520 characters more than

RE: [[strawman:data_parallelism]] |this| and fat arrows

2012-06-15 Thread Hudson, Rick
Hey Mark, ParallelArray and index are left out because of our desire to provide a few good methods that help/force programmers to think about parallel algorithms and not just speeding up sequential algorithms. Array map is really just syntactic sugar for for loops and invites thinking that

Re: RegExp.escape()

2012-06-15 Thread AJ ONeal
YES. PLEASE put this in! http://stackoverflow.com/a/6969486/151312 function escapeRegExp(str) { return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, \\$); } I'm doing my best to reply to every single question that pops up on stackoverflow and point them to this answer... but there are

Re: More fun with undefined

2012-06-15 Thread T.J. Crowder
On 15 June 2012 17:00, Aymeric Vitte vitteayme...@gmail.com wrote: Right now I am not proposing but trying to understand why it is like this Sorry, I thought you were proposing something. Your first message talked about changing how GetValue works, apologies if I misunderstood. Brendan could

Re: Default operator strawman - ||| rather than ??

2012-06-15 Thread Erik Arvidsson
On Fri, Jun 15, 2012 at 6:28 AM, T.J. Crowder t...@crowdersoftware.com wrote: Does anyone have an opinion on a second ternary a'la the above (syntax notwithstanding). So far we have only my opinion (I like it and would have uses for it; I don't _need_ it), Brendan's (too thin)[1], and Herby's

Re: Default operator strawman - ||| rather than ??

2012-06-15 Thread T.J. Crowder
On 15 June 2012 18:05, Erik Arvidsson erik.arvids...@gmail.com wrote: Since you are asking for opinions. I don't want it. It doesn't carry its own weight. I was, and that includes opinions against. Thanks! -- T.J. ___ es-discuss mailing list

Re: RegExp.escape()

2012-06-15 Thread David Herman
On Mar 23, 2012, at 8:16 AM, Steven Levithan wrote: Although this is only a minor convenience since you can do something like text.replace(/[-[\]{}()*+?.,\\^$|]/g, \\$), the list of special characters is subject to change. That sounds like another good argument for standardizing. The only

Protected properties using Name objects

2012-06-15 Thread Brandon Benvie
Currently there's no way to have a data property that is writable by some but not all. This can't even really be achieved with accessors or proxies directly. Rather, the underlying data is mutated through some other avenue, and the value returned on access comes from this secondary source. Neither

Re: ||= is much needed?

2012-06-15 Thread David Herman
On Jun 14, 2012, at 1:45 PM, Brendan Eich wrote: I can see adding ?? and ??= (undefined-only, not undefined-or-null). I think ?? is the highest priority. Is ||= really worth it? It would not assign if the left side is truthy, but perhaps no one will mind. Given ||= is there any oxygen

Re: ||= is much needed?

2012-06-15 Thread Brendan Eich
David Herman wrote: So I favor ?? as well as both ||= and ??=. As for null, I can see how there's confusion about whether to use null vs undefined, and so I can see why CoffeeScript would just try to blur the distinction between them. But I think by sticking to the simpler semantics it will

Re: Protected properties using Name objects

2012-06-15 Thread Brandon Benvie
The description of Object.protectProperty: Object.protectProperty(object : Object, key : String) - Name Object.protectProperty(object : Object, key : String, protector : Name) - true Object.protectProperty(object : Object, currentProtector : Name) - true Object.protectProperty(object : Object,

Re: Protected properties using Name objects

2012-06-15 Thread Herby Vojčík
Hi. I have hard time to put my objections well. Different words appear in my mind like too monolithic, too spaghetti, ... but none of them is very good at explaining the problem. It seems to me that this make thing complex and brittle. Protected overides writable and configurable, so their

Re: Protected properties using Name objects

2012-06-15 Thread Herby Vojčík
Addition to previous post on aliasProperty: you can only create alias on configurable property, of course. Herby ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Protected properties using Name objects

2012-06-15 Thread Brandon Benvie
I addressed some of these as well but didn't put it up here yet. Semantics (this is all on the gist as well in more readable form) * Objects keep an internal map of protector *Name* objects to keys. * A protector can only protect one key per object. * Each key on an object can only have one

Re: Default operator strawman - ||| rather than ??

2012-06-15 Thread Brendan Eich
Erik Arvidsson wrote: On Fri, Jun 15, 2012 at 6:28 AM, T.J. Crowdert...@crowdersoftware.com wrote: Does anyone have an opinion on a second ternary a'la the above (syntax notwithstanding). So far we have only my opinion (I like it and would have uses for it; I don't _need_ it), Brendan's (too

Re: Protected properties using Name objects

2012-06-15 Thread Brandon Benvie
Note: Given the above constraints on configurability, no norms are violated in this. A non-writable property is writable currently using Object.defineProperty. It's just not writable directly, which is upheld here. ___ es-discuss mailing list

Re: Protected properties using Name objects

2012-06-15 Thread David Bruant
Le 15/06/2012 21:27, Brandon Benvie a écrit : Currently there's no way to have a data property that is writable by some but not all. My heartbeat reaction to this first sentence is: is it a use case anyway? This can't even really be achieved with accessors or proxies directly. Rather, the

Re: Protected properties using Name objects

2012-06-15 Thread Brandon Benvie
Actually I'm working on implementing it now. I previously partially implemented Names which is half the equation (though only in V8) and this is just an extension to that. There shouldn't need to be any additional checks using what I've proposed. A non-writable property is no more writable than

Re: ||= is much needed?

2012-06-15 Thread Gavin Barraclough
On Jun 15, 2012, at 12:33 PM, David Herman wrote: So I favor ?? as well as both ||= and ??=. Adding ||= and ??= without = will cause my symmetry-reflex to twitch, despite not seeing a purpose for it I may find it hard to resist supporting that too. ;-) G.

Re: ||= is much needed?

2012-06-15 Thread Brendan Eich
satyr wrote: On Sat, Jun 16, 2012 at 4:33 AM, David Herman dher...@mozilla.com mailto:dher...@mozilla.com wrote: As for null, I can see how there's confusion about whether to use null vs undefined, and so I can see why CoffeeScript would just try to blur the distinction between

Re: [[strawman:data_parallelism]] |this| and fat arrows

2012-06-15 Thread Mark S. Miller
On Fri, Jun 15, 2012 at 11:35 PM, Hudson, Rick rick.hud...@intel.com wrote: Hey Mark, ParallelArray and index are left out because of our desire to provide a few good methods that help/force programmers to think about parallel algorithms and not just speeding up sequential algorithms. Array

Re: ||= is much needed?

2012-06-15 Thread John Tamplin
On Fri, Jun 15, 2012 at 6:00 PM, Brendan Eich bren...@mozilla.com wrote: Can you give a real-world example where null rather than undefined is soaked up? I'm guessing DOM but guessing is bad (cf. Sherlock Holmes). Wouldn't any case where you return null to mean explicitly no object be such a

Re: ||= is much needed?

2012-06-15 Thread Brendan Eich
Maybe, probably, of course ;-). I'm still looking for real-world use-cases, code that actually exists (in CoffeeScript or JS) that needs to soak up null-or-undefined, not just undefined. /be John Tamplin wrote: On Fri, Jun 15, 2012 at 6:00 PM, Brendan Eich bren...@mozilla.com

Re: Default operator strawman - ||| rather than ??

2012-06-15 Thread T.J. Crowder
On 15 June 2012 22:22, Brendan Eich bren...@mozilla.org wrote: If everyone's opinion carries weight, then we are tied :-P. Kidding. But aside from opinions and their weight, we have a problem if wouldn't hurt is the answer for syntax proposals. Who said it was? New syntax does hurt. It

Re: Default operator strawman - ||| rather than ??

2012-06-15 Thread Brendan Eich
T.J. Crowder wrote: On 15 June 2012 22:22, Brendan Eich bren...@mozilla.org mailto:bren...@mozilla.org wrote: If everyone's opinion carries weight, then we are tied :-P. Kidding. But aside from opinions and their weight, we have a problem if wouldn't hurt is the answer for syntax

Re: Default operator strawman - ||| rather than ??

2012-06-15 Thread Brendan Eich
Brendan Eich wrote: * It brings new semantics not expressible in the language (let, const, modules, generators). * It is an affordance without new semantics for a common pattern that's verbose and error-prone when open-coded. Classes (maximally minimal, mainly for extends and super) is a

Re: Protected properties using Name objects

2012-06-15 Thread Brandon Benvie
The gist now includes a rough implementation of this ( https://gist.github.com/2938186 ). ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Announcing, June 15, 2012 ES6 Draft

2012-06-15 Thread Allen Wirfs-Brock
Download it from: http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts Changes from May TC39 Review Tentative addition of Class Definitions Syntax and Semantics in 13.5 based upon Maximally Minimal Strawman. NOTE-Classes do not yet have full consensus within TC39 and may not