Re: r-proto-class

2011-11-15 Thread Axel Rauschmayer
hod and record it as `here` (the object containing the method making a super-reference). Hence, my solution can handle “holes” in the prototype chain, Ashkenas’ solution can’t. But I would not want to use that solution, a static approach is much more elegant. -- Dr. Axel Rauschmayer a...@rau

Re: Demo: static super references

2011-11-15 Thread Axel Rauschmayer
It’s not a big deal, just an illustration of Allen’s work. On Nov 15, 2011, at 15:34 , Dmitry Soshnikov wrote: > On 15.11.2011 18:02, Axel Rauschmayer wrote: >> FWIW: I’ve created a gist that demonstrates static super references (in the >> manner that Allen proposes them

Re: with

2011-11-17 Thread Axel Rauschmayer
esting “of” (prototype `proto` *of* object `obj`), but I think that has been rejected before (and is taken by the for loop). obj of { foo: 12 } of { bar: 13 } of { baz: 17 } -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com __

Re: Nov 16 meeting notes

2011-11-17 Thread Axel Rauschmayer
t into ES.next, but it could inform decisions. Such a library is such a core element of a programming language that we should have a good one as soon as possible. The same holds for other utility functionality (IMHO, ES.next is still too frugal in this department). Axel -- Dr. Axel Rausc

Re: with

2011-11-17 Thread Axel Rauschmayer
ng reused. So there shouldn’t be any surprise that it looks like many things that we have seen already. “Once again” also sounds impolite, but maybe that’s just me. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rausch

Re: with

2011-11-17 Thread Axel Rauschmayer
the symbol `with` is being reused. So there shouldn’t be any surprise that it > looks like many things that we have seen already. I’m might be wrong about that, though, but using <| in the extended manner that he shows has been proposed before. -- Dr. Axel Rauschmayer a...@rauschma

Re: with

2011-11-17 Thread Axel Rauschmayer
[cc-ing es-discuss again] On Nov 17, 2011, at 14:20 , Russell Leggett wrote: > On Thu, Nov 17, 2011 at 6:17 AM, Axel Rauschmayer wrote: >>>obj with { foo: 12 } with { bar: 13 } with { baz: 17 } > > I like the idea! As it is syntactically different in this role, errors sh

Re: with

2011-11-17 Thread Axel Rauschmayer
p RTL. JS is built around English, so LTR seems more > appropriate (with all due sympathy to our Hebrew-speaking programmers!). Going from P <--has-prototype-- o to P --has-instance--> o is fine with me, but it’s not the directionality of [[Prototype]]. -- Dr. Axel Raus

Re: with

2011-11-17 Thread Axel Rauschmayer
rable, foo, bar) { ... } > > I'm not sure what the semantics of this would be. Are you inventing > multiple-prototype inheritance? That's not going to happen. Single inheritance, a prototype chain composed from the given objects, in the given order. An infix operator is

Re: with

2011-11-17 Thread Axel Rauschmayer
ly be properly expressed by something grawlixy, so it might be a moot 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: The class operator: a bridge between object and function exemplers

2011-11-17 Thread Axel Rauschmayer
o get behind it. I still have a fondness for mine, > which is used purely for defining classes, but for most cases, his would work > equally well in the ways I would want to use it. > > - Russ > ___ > es-d

Re: default this binding for ES-next strict mode.

2011-11-18 Thread Axel Rauschmayer
e same thing): http://www.mail-archive.com/es-discuss@mozilla.org/msg11194.html 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

Re: default this binding for ES-next strict mode.

2011-11-18 Thread Axel Rauschmayer
; people who want to use it. > > Optional: Change the value of `this` to be the outer function `this` in > non-strict mode (breaking a large amount of code. I don't think we can get > away with that). > __

Re: motivating <| as structure representation, not operator

2011-11-19 Thread Axel Rauschmayer
oto__ (or Object.create() or Self-ish) manner and then get to constructors. Then I talk about the constructor’s prototype to avoid the longish “the value of the prototype property of the constructor”. But that’s confusing! It’ll get worse should constructors become prototypes of each other in the fu

Re: motivating <| as structure representation, not operator

2011-11-19 Thread Axel Rauschmayer
ars, but there are many similarities. I haven’t found a “lessons learned” document, though. I can even imagine class declarations being used as syntactic sugar for object exemplars. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com _

Re: why not "new" instead of "constructor"?

2011-11-19 Thread Axel Rauschmayer
terested in what > is essentially a bikesheding questions: is this a direction that we shoud > consider? I like the idea of replacing the method name “constructor” with something better, but “new” suggests instantiation *and* initialization to me. Is “init” a possi

Re: motivating <| as structure representation, not operator

2011-11-19 Thread Axel Rauschmayer
th, people (and I don’t exclude myself from that category ;-) simply won’t read it. Or only if they are deeply interested (which one can’t always expect them to be). -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com _

Re: why not "new" instead of "constructor"?

2011-11-19 Thread Axel Rauschmayer
the problem. If not, can I read up on what the problem is? Thanks! Axel On Nov 19, 2011, at 19:33 , Allen Wirfs-Brock wrote: > > On Nov 19, 2011, at 9:54 AM, Axel Rauschmayer wrote: > >>> >> >> I like the idea of replacing the method name “constructor” with

Re: why not "new" instead of "constructor"?

2011-11-19 Thread Axel Rauschmayer
Point = class { x: 0, //not really needed unless defining an object exemplar y: 0, new(x,y) { this.x = x; this.y=y; } }; -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com

Re: why not "new" instead of "constructor"?

2011-11-19 Thread Axel Rauschmayer
ew' instead. That’s what I missed. But wouldn’t that change Allen’s `class` operator to something that performs David’s desugaring as a tranformation (from something that simply returns the value of property `constructor`)? -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de tw

Re: Nov 16 meeting notes

2011-11-23 Thread Axel Rauschmayer
ill indeed have the same size/cardinality-related property as collections. The negative example is Java, where you have length, length(), size() and many other things. JavaScript is still fairly uniform, with the DOM being the exception. -- Dr. Axel Rauschmayer a...@rauschma.de ho

Re: Direct proxies update

2011-11-24 Thread Axel Rauschmayer
On Nov 24, 2011, at 16:37 , David Bruant wrote: >>> We should probably consider using the names 'deleteProperty' and 'construct' >>> instead. > So this sounds like a good idea to work around the issue. Other possibility – a prefix: op_delete, o

What prevents built-in constructors from being extended?

2011-12-02 Thread Axel Rauschmayer
, ...) from working. -- 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

Reifying References?

2011-12-04 Thread Axel Rauschmayer
, but it’s probably too late for that, because this approach has become standard. -- 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

Re: Property vs Behavior inheritance

2011-12-15 Thread Axel Rauschmayer
e = new Person("Jane"); var Employee = Person <| { ... }; I don’t think one would make the mistake of extending jane. Ironically, a class-based mindset works well here and does not lead you astray. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.

Re: Property vs Behavior inheritance

2011-12-16 Thread Axel Rauschmayer
xemplars still holds: JavaScript inheritance would be simpler if a class declaration desugared to a prototype (instead of a constructor). [I am ignoring backward compatibility which is a big thing to ignore.] Sect. 3 of [1] argues that point and gives several code examples. [1] http://www.2ality.co

Re: Property vs Behavior inheritance

2011-12-16 Thread Axel Rauschmayer
have object exemplar semantics? => Easier to detect via static analysis. => Can forbid non-method properties in prototypes. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss maili

Re: Property vs Behavior inheritance

2011-12-16 Thread Axel Rauschmayer
> Sorry I don't understand the question, or how it is related to my > quest. I would argue that your quest can be fulfilled by class declarations that desugar to object exemplars. Do you agree? -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/ra

Re: Property vs Behavior inheritance

2011-12-16 Thread Axel Rauschmayer
about object > exemplars? Because a class declaration will desugar to something. And desugaring to an object exemplar is more elegant than desugaring to a function exemplar. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.c

Math: n-th root, logarithm with arbitrary base

2011-12-18 Thread Axel Rauschmayer
? 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/listinfo/es-discuss

Re: Math: n-th root, logarithm with arbitrary base

2011-12-19 Thread Axel Rauschmayer
, 1/n); >>} >> >>function log_b(b, x) { >>return Math.log(x) / Math.log(b); >> } >> >> Have they been considered and rejected? -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.co

Re: Versioning?

2011-12-19 Thread Axel Rauschmayer
/10/08/what-is-a-polyfill/ > > ...I still don't understand how it differs from "shim" -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list e

Re: Have the scope accessible as an object and implement a new with operator / block

2011-12-20 Thread Axel Rauschmayer
I would love to have something like Python’s locals(): http://docs.python.org/py3k/library/functions.html#locals It would not allow modifications, but it would still be very useful. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com

ECMAScript.next features in Firefox?

2011-12-25 Thread Axel Rauschmayer
Is there a list somewhere of ECMAScript.next features that have already been implemented in Firefox? Thanks! Axel -- Dr. Axel Rauschmayer a...@rauschma.de twitter.com/rauschma Home: rauschma.de Blog: 2ality.com ___ es-discuss mailing list es

Re: ECMAScript.next features in Firefox?

2011-12-25 Thread Axel Rauschmayer
are enabled > through the harmony flag? ( http://codereview.chromium.org/9008031 ) > > On Sun, Dec 25, 2011 at 9:31 AM, Axel Rauschmayer wrote: > Is there a list somewhere of ECMAScript.next features that have already been > implemented in Firefox? > > Thanks! > > A

Confused by Firefox: own property with a descriptor not listed by getOwnPropertyNames()

2011-12-26 Thread Axel Rauschmayer
in neither case? -- 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: Alternative proposal to privateName.public

2011-12-26 Thread Axel Rauschmayer
? define : function(A,F) { module.exports = F.apply(null, A.map(require)) } }). define([ "./module1", "./module2" ], function (module1, module2) { return ... } ); [1] http://www.2ality.com/2011/11/module-gap.html -- Dr. Axel Rauschmayer a.

Re: ES5 Module Systems (was: Alternative proposal to privateName.public)

2011-12-26 Thread Axel Rauschmayer
}; } ); Hence, unless you add to `exports`, Node.js won’t see your module’s contributions. IIRC, Node.js deviates from CJS in that module.exports is an alias for exports. Without that alias, the boilerplate would be more complicated (you’d have to copy the properties of the object

Re: ES5 Module Systems (was: Alternative proposal to privateName.public)

2011-12-26 Thread Axel Rauschmayer
iting > <http://es-lab.googlecode.com/svn/trunk/src/ses/explicit.html> in a modern > browser. If you see the line "AMD loader test...succeeded", then it did. As an aside, one benefit of the above boilerplate is that it is just a prefix (easier to copy and paste than solutions

Re: ES5 Module Systems (was: Alternative proposal to privateName.public)

2011-12-27 Thread Axel Rauschmayer
lp test drive a > define() implementation that could be integrated into Node later, and > by having Node packages use the module, it would give Node committers > a way to scan the package.json info to find out if define() use is > used enough to warrant consideration in their cor

Simple maps/sets: parameterize the comparator?

2011-12-27 Thread Axel Rauschmayer
http://wiki.ecmascript.org/doku.php?id=harmony:simple_maps_and_sets Currently, using Object.is() is hard-coded. But one could allow a comparator function being handed in (with Object.is being the default). -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com

Re: Why we need to clean up __proto__

2011-12-28 Thread Axel Rauschmayer
arise in real systems? As > observed at > <http://www.google.com/support/forum/p/Google+Docs/thread?tid=0cd4a00bd4aef9e4>, > until recently, on all non-IE browsers, if you typed "__proto__" at the > beginning of a new Google Doc, your Google Doc would hang. This wa

Re: Why we need to clean up __proto__

2011-12-28 Thread Axel Rauschmayer
On Dec 28, 2011, at 17:13 , John J Barton wrote: > Doesn't Object.keys() solve this problem? For getting elements, yes. For setting, the problem with the illegal own property name "__proto__" remains. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: tw

Re: How to clean up __proto__ (was: Why we need to clean up __proto__)

2011-12-29 Thread Axel Rauschmayer
) fails to avoid this platform on all > non-IE browsers.) -- 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: Simple maps/sets: parameterize the comparator?

2011-12-29 Thread Axel Rauschmayer
.uk/~mas01cr/papers/ilc2007/sequences-20070301.pdf - Programming languages with collection APIs (among many others): Smalltalk, Java - Guava http://code.google.com/p/guava-libraries/ -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.co

Preparing for type guards

2011-12-29 Thread Axel Rauschmayer
to standardize simple guard methods now, for example: function foo(x) { Object.guard(x, Number); } Advantages: Helps tools (to infer types, to generate documentation), can later be refactored to real guards. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter

Re: Simple maps/sets: parameterize the comparator?

2011-12-29 Thread Axel Rauschmayer
behavior in the face of comparator > misbehavior seems hard, and > 3) we'd like to avoid yet more under-specification. The similar > under-specification of Array.prototype.sort is already bad enough. > > On Tue, Dec 27, 2011 at 7:22 AM, Axel Rauschmayer wrote: > http://wik

Standardizing stack straces?

2011-12-29 Thread Axel Rauschmayer
It’d be nice if stack traces were standardized. Are there any plans to do so? The following project could be used for shims: http://stacktracejs.org/ Axel -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com

Re: Preparing for type guards

2011-12-29 Thread Axel Rauschmayer
e system is much closer to JavaScript + minimal type guards than I initially thought. That’s a part of it I really like. -- 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: function() {}.bind(this) -> this.function(){} ?

2011-12-29 Thread Axel Rauschmayer
proposal covers this (pun might be intended) > > window.foo = function() { > console.log("hi!"); > }; > > window.addEventListener('load', {|| > this.foo(); // "hi!" > }, false); > > > http://wiki.ecmascript.org/doku.php?id=strawman:block_l

Re: Simple maps/sets: parameterize the comparator?

2011-12-29 Thread Axel Rauschmayer
ere might be some additional insights in what the Lispers are doing. This is more of a hunch than actual knowledge of mine – I simply like their way of thinking about object-orientation. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com _

Re: Sorted arrays

2011-12-30 Thread Axel Rauschmayer
thods non enumerable): > http://jsfiddle.net/xavierm02/exwtg/ > ___ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de

Re: ES6 doesn't need opt-in

2011-12-31 Thread Axel Rauschmayer
ly depriving programmers of ES6 > goodies such as destructuring or spread/rest. I’m not entirely sure, but introducing two new dialects (ES5.5 and ES6, if you will) at the same time seems problematic. It might be easier to stick to the simpler rule of “global = ES5”. Apart from that: sold. -- Dr. A

Re: ES6 doesn't need opt-in

2011-12-31 Thread Axel Rauschmayer
mented as functions (and be brought to ES5 via shims). A function such the #5 getTypeName() could take care of use case #4, as well. Ideas for getTypeName(): http://www.2ality.com/2011/11/improving-typeof.html -- Dr. Axel Rauschmayer a...@rauschma.de home: r

Object Model Reformation – elementIn?

2012-01-01 Thread Axel Rauschmayer
)? -- 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: ES6 doesn't need opt-in

2012-01-01 Thread Axel Rauschmayer
odule) } }). // Node.js define(function (require, exports, module) { // Node.js module code goes here }); Alternative: wrap a function around define(), make define a parameter, perform the (same!) check when immediately-invoking the function. -- Dr.

Re: ES6 doesn't need opt-in

2012-01-01 Thread Axel Rauschmayer
preferred, one could give it a name such as `exists`. Furthermore, it might be more consistent with value ?? default to make ?? a postfix operator, but I can’t judge the grammatical implications of that. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitt

Re: ES6 doesn't need opt-in

2012-01-01 Thread Axel Rauschmayer
// false console.log(exists undefined); // false console.log(exists null); // false var obj = {}; console.log(exists obj.prop); // false -- 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: ES6 doesn't need opt-in

2012-01-01 Thread Axel Rauschmayer
for reasons of symmetry to me, a variable having been declared is the same as a property existing. JavaScript differs from most languages in that it doesn’t report an error when a non-existant property is accessed. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/ra

Re: Object Model Reformation – elementIn?

2012-01-02 Thread Axel Rauschmayer
{ ... } -- 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: String.prototype.until

2012-01-02 Thread Axel Rauschmayer
ined as acting the same way as the following code: > > String.prototype.until = function (needle) { > return this.substr(0, this.indexOf(needle)); > } -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___

Re: String.prototype.until

2012-01-02 Thread Axel Rauschmayer
nd last name), you could > easily call name.until(' ') and get that back. > > On Mon, Jan 2, 2012 at 11:55, Axel Rauschmayer wrote: >> Isn’t that usually better handled via a regular expression? >> >> One of the use cases for quasis [1][2] is to make it easy to

Suggestion: Array.prototype.repeat

2012-01-02 Thread Axel Rauschmayer
= len * times; for(var i = 0; i < resultLen; i++) { result.push(this[i % len]); } return result; } In use: $ [1,2,3].repeat(3) [ 1, 2, 3, 1, 2, 3, 1, 2, 3 ] -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.

Re: ES6 doesn't need opt-in

2012-01-02 Thread Axel Rauschmayer
&& x !== null The expression would not throw an exception if x hasn’t been declared. The two most important use cases for typeof probably are: - isDefined - Helping to implement getTypeName() whose results are - "null", "

Re: ES6 doesn't need opt-in

2012-01-02 Thread Axel Rauschmayer
statement). Then the thing to add to the proposal would be ?? used as a unary postfix operator: if (x??) ... Prefix might work, too. -- 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

?? operator (was: ES6 doesn't need opt-in)

2012-01-03 Thread Axel Rauschmayer
P.S. Are CoffeeScript's `func? arg` and `obj?.prop` too extreme? The former is part of Crockford’s proposal [1]. The latter is very useful indeed. [1] http://wiki.ecmascript.org/doku.php?id=strawman:default_operator -- Dr. Axel Rauschmayer a...@rauschma.de hom

Array.range() (was: Suggestion: Array.prototype.repeat)

2012-01-03 Thread Axel Rauschmayer
ure how many use cases there are (suggestions welcome), but it does fill a hole (IIRC, Python has something similar). TODO: This method probably makes more sense as an iterator (e.g. implemented via a generator). Then one could even omit the upper limit and produce an unlimited sequence. [1] http://wi

Re: Array.range() (was: Suggestion: Array.prototype.repeat)

2012-01-03 Thread Axel Rauschmayer
4 Array.range({ step: 3 }) -> 0, 3, 6, 9, ... Array.range({ start: -2, step: -1 }) -> -2, -3, -4, -5, ... etc. The defaults of start and end and the comparison operator depend on the sign of step. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com

Re: Array.range() (was: Suggestion: Array.prototype.repeat)

2012-01-03 Thread Axel Rauschmayer
) -> 5, 3, 1 > > On Tue, Jan 3, 2012 at 11:42 AM, Axel Rauschmayer wrote: >> I think it's fairly common for range implementations to provide an optional >> `step` parameter >> >> >> Good point. Maybe all of these parameters should be options: >>

Re: ES6 doesn't need opt-in

2012-01-04 Thread Axel Rauschmayer
r server-side or client-side, possibly including caching)? This multi-version scheme could even be applied to (the JS code embedded in) HTML files. Axel -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com _

Re: ES6 doesn't need opt-in

2012-01-04 Thread Axel Rauschmayer
use strict; // causes an early error on old browsers. > > Had we adopting it into ES5, it would have this meaning clearly. It may still > be a good idea, but consider the new complexity. Now the second form also > causes an early error on old ES5 browsers, where the script might ot

Re: Improving Function.prototype.bind

2012-01-05 Thread Axel Rauschmayer
ses are equal (which I think is carried over to data structures), but not the same reference. It’s a shame that we are really close in JavaScript, with the ECMA-262 specification using references. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.

Re: Improving Function.prototype.bind

2012-01-05 Thread Axel Rauschmayer
> that would not solve much 'cause you can bind a function to a single object > and no more. Isn’t that the most frequent use case? Do you have examples where you bind the same function to several objects? -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter:

Re: ES6 doesn't need opt-in

2012-01-05 Thread Axel Rauschmayer
ges such as Java, JavaScript additionally faces the challenge that a developer can’t control what language version is implemented by the browser. How will that be handled? Sketching a solution would provide a more complete picture of how to migrate to ES6. -- Dr. Axel Rauschmayer a...@r

Re: Improving Function.prototype.bind

2012-01-05 Thread Axel Rauschmayer
t going into ES.next is diverse (E, Racket, Smalltalk, etc.). Lastly, progress is steady and if ES.next is finished by 2013 then that is quite impressive. Compare: five years between Java 6 – with few new features – and Java 7. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter:

Re: Improving Function.prototype.bind

2012-01-05 Thread Axel Rauschmayer
not as first evaluating obj.foo and then applying the () operator) then things do make sense – evaluating obj.foo is a different thing and simply gives you back the function you put there. And, thankfully, with strict mode, things fail fast if you forget to bind() a method. -- Dr. Axel Rauschmayer a.

Re: ES6 doesn't need opt-in

2012-01-06 Thread Axel Rauschmayer
be an error. As a human, I would want an ES6 trigger to appear as early as possible. I wouldn’t want to read through a file, encounter an ES6 trigger at the end and then have to revise the understanding of the code that I had so far. I like the whole-file-or-nothing approach

Re: ES6 doesn't need opt-in

2012-01-06 Thread Axel Rauschmayer
ible (“The construct has identical syntax and static semantics in both ES5 and ES6, but differing semantics.”) -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss mailing list es-discuss

Re: ES6 doesn't need opt-in

2012-01-06 Thread Axel Rauschmayer
o specify only (exclusively) an ES6 environment. You pretend to live in a “perfect ES6 world” and then only have two labels. There are two ways out of this world: - Non-ES6 environments for implementors: refer to ECMA-262 version 5.1. - Non-ES6 environments for developers: simulate ES6 (via sta

Re: ES6 doesn't need opt-in

2012-01-06 Thread Axel Rauschmayer
ne hand and ES6 and ES5.strict on the other hand. But it makes sense that even if developers (engine users) are presented with something simple, implementors have to take care of many more details. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rausch

Re: ES6 doesn't need opt-in

2012-01-07 Thread Axel Rauschmayer
On Jan 7, 2012, at 23:22 , Claus Reinke wrote: > But the new plan reminds me strongly of bad experiences in Haskell-land. That sounds interesting. Is this documented somewhere? -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.

Re: ES6 doesn't need opt-in

2012-01-07 Thread Axel Rauschmayer
s-from-ES6) ES5.nonstrict-ES6-intersection ES6-only (=ES6-differs-from-ES5.nonstrict) This might be about to the question as to whether there should be a mode that combines ES6-differs-from-ES5.strict constructs with ES5.nonstrict. I don’t think there should be. -- Dr. Axel Rauschmayer a...@rausc

Re: Harmony modules feedback

2012-01-12 Thread Axel Rauschmayer
f it applies to ECMAScript, but > some of it ties into my comments on ECMAScript, so I think it is best > to leave it in the blog post vs. reproducing here. Also, I do not > expect answers to my questions right away, just throwing out things > that would be nice to have answered as part of th

Re: Octal literals have their uses (you Unix haters skip this one)

2012-01-12 Thread Axel Rauschmayer
ecimal literal to > dodge the error, but then JS/Node.js is at a loss, and for no good reason. In > this case I will argue for supporting octal literals in strict mode. > > /be > > ___ > es-discuss mailing list > es-discuss@m

Re: Octal literals have their uses (you Unix haters skip this one)

2012-01-12 Thread Axel Rauschmayer
both. Then we have three kinds of non-decimal literals, for example: 0b1011, 0o732 and 0x. For long literals, Java has started to make "_" as a separator legal, that would be nice to have, too: let aLotOfMoney = 120_327_756_228; -- Dr. Axel Rauschmayer a...@rauschma.de home

Re: Block lambda is cool, its syntax isn't

2012-01-12 Thread Axel Rauschmayer
does that code profit from block lambdas – really nice to look at. In some cases, things would fit into a single line where you were forced to split into multiple lines without BLs. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitte

Block lambda grammar: BlockArguments

2012-01-12 Thread Axel Rauschmayer
, initValue2) { | arg1, arg2 | ... } -- 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: Block Lambdas: break and continue

2012-01-13 Thread Axel Rauschmayer
I think it’s a valid concern. The idea is: If I can implement my own loops (the nice-looking paren-free syntax feeds that illusion!) then I also want those loops to have break and continue. You could statically determine what construct, say, a break applies to and either throw a BreakException (if

Re: Block lambda grammar: BlockArguments

2012-01-13 Thread Axel Rauschmayer
make lambdas trailing arguments, similar to if (cond) {} {} And I would rather achieve this effect without currying. Following a block with a non-block doesn’t seem like a good idea. Has the other approach been considered? -- Dr. Axel Rauschmayer a...@rauschma.de home: r

Re: Block Lambdas: break and continue

2012-01-14 Thread Axel Rauschmayer
be able to > predict what `break` and `continue` will do. I don’t think it’s a must-have, but whenever you catch exceptions, you have similar issues. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com _

Re: Block Lambdas: break and continue

2012-01-14 Thread Axel Rauschmayer
} } -- 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: Block lambda grammar: BlockArguments

2012-01-14 Thread Axel Rauschmayer
ollowing a block with a non-block doesn’t seem like a good idea. With a normal paren call, I don’t see any problems. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com ___ es-discuss

Re: Block lambda grammar: BlockArguments

2012-01-14 Thread Axel Rauschmayer
re either parenthesized or paren-free. In the latter case, all parameters must be lambdas.” -- 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: Block lambda grammar: BlockArguments

2012-01-14 Thread Axel Rauschmayer
Cool. I also have a feeling that every paren-free lambda after the first one should have some kind of preceding keyword or name, but I don’t know how one could make that happen. Brace-free object literals? (only half joking)On Jan 15, 2012, at 3:42 , Brendan Eich wrote: Brendan Eich

Re: Block Lambdas: break and continue

2012-01-15 Thread Axel Rauschmayer
xtensively). Then it should become clear where/if people miss break and continue. A label is a reasonable work-around that should even survive the insertion of a “loop-ifying” keyword. Could we call block lambdas just lambdas? The former seems a bit pleonastic. -- Dr. Axel Rauschmayer a...@r

Re: ES6 opt-in, reloaded

2012-01-16 Thread Axel Rauschmayer
at has been discussed so far *might* also eventually be, but I don’t see it (yet). Claus Reinke’s recount of lessons learned by the Haskell community in this area also seems relevant: https://mail.mozilla.org/pipermail/es-discuss/2012-January/019396.html Axel -- Dr. Axel Rauschmayer a...@rausc

Re: Harmony modules feedback

2012-01-16 Thread Axel Rauschmayer
including ES3. We should > see if we can identify a translation between well chosen subsets of AMD and > ES.next modules. But even if no good automatic translation is found, code > written to AMD will be more easily ported to ES.next modules than code > written by current we

Re: Block Lambdas: break and continue

2012-01-16 Thread Axel Rauschmayer
if (...) break exit with "early"; //[no LineTerminator here] > before "with" > ... > } >}; +1 It might make sense to also introduce an “unlabeled” break-with that exits from the current (unlabeled) block. -- Dr. Axel Rauschmayer a...@raus

Re: Harmony modules feedback

2012-01-16 Thread Axel Rauschmayer
h gives you the possibility to isolate yourself locally from the rest of the system. That is, you can override “system modules” locally. -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com

Re: Harmony modules feedback

2012-01-16 Thread Axel Rauschmayer
@Andrea, Mariusz: Are you aware of the RequireJS optimizer [1]? It can be used together with almond [2], an AMD loader with minimal footprint. [1] http://requirejs.org/docs/optimization.html [2] https://github.com/jrburke/almond -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de

<    1   2   3   4   5   6   >