Re: Modules, Concatenation, and Better Solutions

2012-10-16 Thread John J Barton
On Tue, Oct 16, 2012 at 7:10 PM, David Herman wrote: > On Oct 16, 2012, at 4:51 PM, John J Barton > wrote: ... > > Concrete example: Even and Odd modules refer to each other, but the import > statements occur after some initialization: > > module Odd { > export let odd = function(x)

Re: Modules, Concatenation, and Better Solutions

2012-10-16 Thread David Herman
On Oct 16, 2012, at 4:51 PM, John J Barton wrote: > On Tue, Oct 16, 2012 at 2:58 PM, David Herman wrote: >> The weird thing about (a) is that code that appears to be straight-line >> actually executes in somewhat more unpredictable (although deterministic) >> order. > > I guess if we can hand

Re: Modules, Concatenation, and Better Solutions

2012-10-16 Thread John J Barton
On Tue, Oct 16, 2012 at 2:58 PM, David Herman wrote: > On Oct 15, 2012, at 6:45 AM, Kevin Smith wrote: > >> OK, so: >> >> module A { >> console.log("a"); >> export var x; >> } >> >> console.log("$"); >> import x from A; >> >> Does this print: > > Good question. The way

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Tab Atkins Jr.
On Tue, Oct 16, 2012 at 4:06 PM, Yehuda Katz wrote: > On Tue, Oct 16, 2012 at 6:26 PM, Mark S. Miller wrote: >> Getting the comments with a getter seems fine. Appending only the list of >> comments with a setter is bad, as it does not resemble storage semantics. > > Do you mean appending only to

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Brendan Eich
Yehuda Katz wrote: I feel somewhat strongly that this is an appropriate use of a setter. Using a method would give the API a static language feel for not enough win. In the case of a well-defined API with well-understood links between objects, a setter feels right to me. I'm not super-religio

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Yehuda Katz
On Tue, Oct 16, 2012 at 6:26 PM, Mark S. Miller wrote: > Getting the comments with a getter seems fine. Appending only the list of > comments with a setter is bad, as it does not resemble storage semantics. Do you mean appending only *to* to list of comments? `comment.post = post` has similar

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Yehuda Katz
Yehuda Katz (ph) 718.877.1325 On Tue, Oct 16, 2012 at 5:13 PM, Brendan Eich wrote: > Yehuda Katz wrote: > >> Agreed. For example: >> >> class Post { >> >> } >> >> class Comment { >> >> } >> >> Post.hasMany("comments"); >> Comment.belongsTo("post"); >> >> let post = new Post() >> let comment = n

Re: [Fwd: Fail-fast on non-existing [[Get]]]

2012-10-16 Thread Yehuda Katz
Yehuda Katz (ph) 718.877.1325 On Tue, Oct 16, 2012 at 12:51 PM, Herby Vojčík wrote: > This did not get to the list, reposting... > > Original Message > From: Herby Vojčík > Subject: Fail-fast on non-existing [[Get]] > Date: Fri, 12 Oct 2012 22:42:05 +0200 > To: ECMAScript dis

Re: Modules, Concatenation, and Better Solutions

2012-10-16 Thread James Burke
On Tue, Oct 16, 2012 at 2:58 PM, David Herman wrote: > prints "a" then "b" then "main". That's clearly a problem for simple > concatenation. On the one hand, the point of eager execution was to make the > execution model simple and consistent with corresponding IIFE code. On the > other hand, e

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Mark S. Miller
Getting the comments with a getter seems fine. Appending only the list of comments with a setter is bad, as it does not resemble storage semantics. I would expect well written setters to at least be idempotent, and well written getters to be side effect free. On Tue, Oct 16, 2012 at 2:36 PM, Tab

Re: Modules, Concatenation, and Better Solutions

2012-10-16 Thread David Herman
On Oct 15, 2012, at 6:45 AM, Kevin Smith wrote: > OK, so: > > module A { > console.log("a"); > export var x; > } > > console.log("$"); > import x from A; > > Does this print: Good question. The way we have it currently specified isn't ideal for concatenation, I th

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Yehuda Katz
Yehuda Katz (ph) 718.877.1325 On Tue, Oct 16, 2012 at 5:43 PM, Allen Wirfs-Brock wrote: > > On Oct 16, 2012, at 2:36 PM, Tab Atkins Jr. wrote: > > > On Tue, Oct 16, 2012 at 2:24 PM, Allen Wirfs-Brock > >> > >> You might not agree with the above guideline, or choose to follow it. > >> That's fine

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Tab Atkins Jr.
On Tue, Oct 16, 2012 at 2:43 PM, Allen Wirfs-Brock wrote: > On Oct 16, 2012, at 2:36 PM, Tab Atkins Jr. wrote: >> On Tue, Oct 16, 2012 at 2:24 PM, Allen Wirfs-Brock >>> >>> You might not agree with the above guideline, or choose to follow it. >>> That's fine. But, what you you propose as an alter

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Allen Wirfs-Brock
On Oct 16, 2012, at 2:36 PM, Tab Atkins Jr. wrote: > On Tue, Oct 16, 2012 at 2:24 PM, Allen Wirfs-Brock >> >> You might not agree with the above guideline, or choose to follow it. >> That's fine. But, what you you propose as an alternative. What are your >> guidelines for choosing to use an ac

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Tab Atkins Jr.
On Tue, Oct 16, 2012 at 2:24 PM, Allen Wirfs-Brock wrote: > On Oct 16, 2012, at 1:25 PM, Yehuda Katz wrote: >> Agreed. For example: >> >> class Post { >> >> } >> >> class Comment { >> >> } >> >> Post.hasMany("comments"); >> Comment.belongsTo("post"); >> >> let post = new Post() >> let comment = ne

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Allen Wirfs-Brock
On Oct 16, 2012, at 1:25 PM, Yehuda Katz wrote: > Agreed. For example: > > class Post { > > } > > class Comment { > > } > > Post.hasMany("comments"); > Comment.belongsTo("post"); > > let post = new Post() > let comment = new Comment(); > > comment.post = post; > post.comments //=> [comment

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Brendan Eich
Yehuda Katz wrote: Agreed. For example: class Post { } class Comment { } Post.hasMany("comments"); Comment.belongsTo("post"); let post = new Post() let comment = new Comment(); comment.post = post; post.comments //=> [comment] I'm with Allen: you shoulda used a method! I know, this is a

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Brendan Eich
Erik Arvidsson wrote: On Mon, Oct 15, 2012 at 12:23 PM, Brendan Eich wrote: * get/set accessor may have effects on 'set' (see the DOM) but only on the receiver object (and unobservably, any children that become garbage, e.g. when trimming .length on an array-like). That is very limiting, even

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Yehuda Katz
Agreed. For example: class Post { } class Comment { } Post.hasMany("comments"); Comment.belongsTo("post"); let post = new Post() let comment = new Comment(); comment.post = post; post.comments //=> [comment] This is similar to certain DOM APIs, and my expectation of a hypothetical version o

Re: Fixing instanceof / typeof

2012-10-16 Thread Irakli Gozalishvili
Most recently I needed that to do polymorphic function dispatch on input argument type. More specifics can be found here: https://github.com/Gozala/method/blob/master/core.js#L121-127 This case may be quite exotic, but I remember running into this quite a lot, can't use cases unfortunately. BT

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Erik Arvidsson
On Mon, Oct 15, 2012 at 12:23 PM, Brendan Eich wrote: > * get/set accessor may have effects on 'set' (see the DOM) but only on the > receiver object (and unobservably, any children that become garbage, e.g. > when trimming .length on an array-like). That is very limiting, even as a guideline. Any

Re: ES transpilers

2012-10-16 Thread Claus Reinke
It would be helpful if that page listed licenses and minimum es target versions (es5? es3?) Yes, I was thinking of flagging at least commercial vs free tools at some point (*). If I receive concrete information about target ES versions for transpilers, I will add that, too (though that kind of d

Re: Modular At-Names

2012-10-16 Thread Yehuda Katz
Yehuda Katz (ph) 718.877.1325 On Tue, Oct 16, 2012 at 11:48 AM, Kevin Smith wrote: > >>> What do you think about the typo problem? Not a major issue? >> > > It's javascript, so I guess I'm used to getting pinched every now and then > by a little property misspelling. It's never caused me to mi

Re: Modular At-Names

2012-10-16 Thread Brendan Eich
Brendan Eich wrote: Agreed, this thread proposed an alternative that actually threw out privacy in order to avoid collisions and match today's JS patterns. I should have written "... threw out privacy in order to simplify and focus only on avoiding collisions and matching " /be

Re: Minutes from 10/5 internationalization ad-hoc meeting

2012-10-16 Thread Gillam, Richard
What you're saying is directly in line with what the i18n group was thinking: Encoding conversion is still useful, but should probably be in a library of its own, not in the general i18n library. I'm glad to see that this is happening. --Rich Gillam Lab126 On Oct 16, 2012, at 9:18 AM, Joshua

Re: Modular At-Names

2012-10-16 Thread Brendan Eich
Allen Wirfs-Brock wrote: On Oct 16, 2012, at 9:11 AM, Brendan Eich wrote: Allen Wirfs-Brock wrote: The module vs. let scope is also interesting. Allen said the literature favored the latter but that wasn't clear from my nowhere-near-comprehensive reading. Presumably that is a large part of o

Re: Modular At-Names

2012-10-16 Thread Allen Wirfs-Brock
On Oct 16, 2012, at 9:11 AM, Brendan Eich wrote: > Allen Wirfs-Brock wrote: >>> The module vs. let scope is also interesting. Allen said the literature >>> favored the latter but that wasn't clear from my nowhere-near-comprehensive >>> reading. >> >> Presumably that is a large part of our mot

Re: Modular At-Names

2012-10-16 Thread Brendan Eich
Herby Vojčík wrote: And if yes doesn't this mean it is better to use `public` instead of `symbol` in standalone non-private symbol declarations, as well, for the consistency? Syntax is being debated. Allen used 'symbol' but 'public' is another candidate (and already reserved). /be _

[Fwd: Fail-fast on non-existing [[Get]]]

2012-10-16 Thread Herby Vojčík
This did not get to the list, reposting... Original Message From: Herby Vojčík Subject: Fail-fast on non-existing [[Get]] Date: Fri, 12 Oct 2012 22:42:05 +0200 To: ECMAScript discussion Hello! I have just looked the video on channel9 between Lars Bak and Anders Hejlsberg, an

Re: Modular At-Names

2012-10-16 Thread Herby Vojčík
Allen Wirfs-Brock wrote: On Oct 15, 2012, at 6:02 PM, Brendan Eich wrote: Axel Rauschmayer wrote: One thing to consider: I would expect IDEs to help with this. For example, Eclipse does a pretty good job of letting one forget that one has to import things before one can use them. Maybe, b

Re: Minutes from 10/5 internationalization ad-hoc meeting

2012-10-16 Thread Joshua Bell
On Mon, Oct 15, 2012 at 5:51 PM, Gillam, Richard wrote: > ** > > *Encoding conversion and detection.* Most of the time, text has already > been converted to UTF-16 before it surfaces in JavaScript, so the use cases > here basically all revolve around reading legacy file formats and > communicat

Re: Modular At-Names

2012-10-16 Thread Brendan Eich
Allen Wirfs-Brock wrote: The module vs. let scope is also interesting. Allen said the literature favored the latter but that wasn't clear from my nowhere-near-comprehensive reading. Presumably that is a large part of our motivation for providing lexically scoped let/const/function/class rather

Re: Modular At-Names

2012-10-16 Thread Kevin Smith
> > >> What do you think about the typo problem? Not a major issue? > It's javascript, so I guess I'm used to getting pinched every now and then by a little property misspelling. It's never caused me to miss C#/C++/Java/etc. And it all washes out with proper testing. It seems orthogonal to me a

Re: Modular At-Names

2012-10-16 Thread Yehuda Katz
Yehuda Katz (ph) 718.877.1325 On Tue, Oct 16, 2012 at 9:45 AM, Kevin Smith wrote: > 1. The one-class-per-file pattern is near universal. When there is more > than one class, they tend to be in minor supporting roles (like > exception-type subclasses or simple data structures). > > 2. Adding pr

Re: ES accessor usage guidelines (Was: Map/Set.prototype.size)

2012-10-16 Thread Allen Wirfs-Brock
On Oct 15, 2012, at 9:20 PM, Brendan Eich wrote: > Allen Wirfs-Brock wrote: >> ... > > So you're right, orphaned children suffer mutation to null .parentNode -- > legacy feature indeed! > >> but most alternatives would make it either directly or indirectly observable >> via the captured elem

Re: New ECMAScript Internationalization API Specification draft

2012-10-16 Thread Alex Russell
On Mon, Oct 15, 2012 at 7:44 PM, Norbert Lindenberg < ecmascr...@norbertlindenberg.com> wrote: > The 12 October 2012 draft of the ECMAScript Internationalization API > Specification is available at > http://wiki.ecmascript.org/doku.php?id=globalization:specification_drafts > and due to popular dem

Re: Modules, Concatenation, and Better Solutions

2012-10-16 Thread Patrick Mueller
On Tue, Oct 16, 2012 at 9:21 AM, Kevin Smith wrote: > Patrick, it must be the other way. Here's why: > > module A { > export function f() { console.log("A"); } > } > > A.f(); > > No import required before usage of an inline module. There is a > concatenation strategy which w

Re: Modular At-Names

2012-10-16 Thread Kevin Smith
1. The one-class-per-file pattern is near universal. When there is more than one class, they tend to be in minor supporting roles (like exception-type subclasses or simple data structures). 2. Adding private, protected, etc. declarations to classes adds a good deal of baggage to the syntax that m

RE: Modular At-Names

2012-10-16 Thread Domenic Denicola
From: es-discuss-boun...@mozilla.org [mailto:es-discuss-boun...@mozilla.org] On Behalf Of Yehuda Katz Sent: Tuesday, October 16, 2012 09:13 > Or, more commonly, symbols that are used in a single class that happens to be > inside a module. Although I can't be sure about this, I expect that a larg

Re: Modules, Concatenation, and Better Solutions

2012-10-16 Thread Yehuda Katz
Yehuda Katz (ph) 718.877.1325 On Tue, Oct 16, 2012 at 9:21 AM, Kevin Smith wrote: > > Just to be sure... Does a get printed only the first time the module A is >> imported somewhere, or every time? >> > > Only the first time. But the question here is about nested/inline modules. > > Patrick, i

Re: Modules, Concatenation, and Better Solutions

2012-10-16 Thread Kevin Smith
> Just to be sure... Does a get printed only the first time the module A is > imported somewhere, or every time? > Only the first time. But the question here is about nested/inline modules. Patrick, it must be the other way. Here's why: module A { export function f() { console.log(

Re: Modular At-Names

2012-10-16 Thread Yehuda Katz
Yehuda Katz (ph) 718.877.1325 On Mon, Oct 15, 2012 at 9:46 PM, Allen Wirfs-Brock wrote: > > On Oct 15, 2012, at 6:02 PM, Brendan Eich wrote: > > > Axel Rauschmayer wrote: > >> One thing to consider: I would expect IDEs to help with this. For > example, Eclipse does a pretty good job of letting o

Re: Modules, Concatenation, and Better Solutions

2012-10-16 Thread Jussi Kalliokoski
Just to be sure... Does a get printed only the first time the module A is imported somewhere, or every time? On Tue, Oct 16, 2012 at 3:57 PM, Patrick Mueller wrote: > On Mon, Oct 15, 2012 at 9:45 AM, Kevin Smith wrote: > >> OK, so: >> >> module A { console.log("a"); export var x; } >> c

Re: Modules, Concatenation, and Better Solutions

2012-10-16 Thread Patrick Mueller
On Mon, Oct 15, 2012 at 9:45 AM, Kevin Smith wrote: > OK, so: > > module A { console.log("a"); export var x; } > console.log("$"); > import x from A; > > Does this print: > $ > a > or > a > $ > The first - "$", then "a". At least, that's how most module systems I've

Re: ES transpilers

2012-10-16 Thread Alex Russell
It would be helpful if that page listed licenses and minimum es target versions (es5? es3?) Regards On Oct 16, 2012, at 5:12 AM, Claus Reinke wrote: > > With ES6 engine compatibility still looking somewhat red > > http://kangax.github.com/es5-compat-table/es6/ > > transpilers are not just a use