Re: typed objects and value types

2014-04-02 Thread Andreas Rossberg
On 2 April 2014 20:26, Mark S. Miller wrote: > We could specify that WeakMaps can use typed objects as keys. The current > discussion in your article confuses semantics with implementation when it > speaks of typed objects comparing structurally. Typed objects have identity, > characterized by the

Re: typed objects and value types

2014-04-02 Thread Andreas Rossberg
On 2 April 2014 19:37, Niko Matsakis wrote: > Along those lines, user-defined values (uvalues) probably ought to > have the following characteristics: > > - uvalues are (shallowly) immutable > - uvalues have no "generative identity", and are compared using "by-value" === > - uvalues have a prototy

Re: typed objects and value types

2014-04-02 Thread Tab Atkins Jr.
On Wed, Apr 2, 2014 at 3:43 PM, Kevin Smith wrote: > What missing expressive capability does this give developers, aside from > overloading of "equality"? > > Obviously, being able to directly represent an int33 (for example) is > useful, but I'm not seeing the motivation behind user-defined value

Re: typed objects and value types

2014-04-02 Thread Kevin Smith
What missing expressive capability does this give developers, aside from overloading of "equality"? Obviously, being able to directly represent an int33 (for example) is useful, but I'm not seeing the motivation behind user-defined value objects, yet, aside from overloading equality. On Wed, Apr

Re: typed objects and value types

2014-04-02 Thread Dmitry Lomov
On Wed, Apr 2, 2014 at 10:17 PM, Mark S. Miller wrote: > > > However, I have to quibble with "observable". WeakRefs make GC observable. > WeakMaps do not. Running out of memory, or failing to, is not an > observation, since the spec never says when this might or might not occur > anyway. In fact,

Re: typed objects and value types

2014-04-02 Thread Mark S. Miller
On Wed, Apr 2, 2014 at 1:02 PM, Dmitry Lomov wrote: > > On Wed, Apr 2, 2014 at 9:36 PM, Mark S. Miller wrote: > >> You can't recreate a given fat pointer out of thin air. You need at least >> the same backing buffer, or something (e.g., another fat pointer) which >> retains the same backing buffe

Re: typed objects and value types

2014-04-02 Thread Dmitry Lomov
On Wed, Apr 2, 2014 at 9:36 PM, Mark S. Miller wrote: > You can't recreate a given fat pointer out of thin air. You need at least > the same backing buffer, or something (e.g., another fat pointer) which > retains the same backing buffer. > > The backing buffer has generative identity, so the Wea

Re: typed objects and value types

2014-04-02 Thread Mark S. Miller
You can't recreate a given fat pointer out of thin air. You need at least the same backing buffer, or something (e.g., another fat pointer) which retains the same backing buffer. The backing buffer has generative identity, so the WeakMap should hold on to the backing buffer weakly[1], but it shoul

Re: typed objects and value types

2014-04-02 Thread Dmitry Lomov
On Wed, Apr 2, 2014 at 9:11 PM, Dmitry Lomov wrote: > > > > On Wed, Apr 2, 2014 at 8:26 PM, Mark S. Miller wrote: > >> >> >> We could specify that WeakMaps can use typed objects as keys. The current >> discussion in your article confuses semantics with implementation when it >> speaks of typed o

Re: typed objects and value types

2014-04-02 Thread Dmitry Lomov
On Wed, Apr 2, 2014 at 8:26 PM, Mark S. Miller wrote: > > > We could specify that WeakMaps can use typed objects as keys. The current > discussion in your article confuses semantics with implementation when it > speaks of typed objects comparing structurally. Typed objects have > identity, charac

Re: typed objects and value types

2014-04-02 Thread Mark S. Miller
On Wed, Apr 2, 2014 at 10:37 AM, Niko Matsakis wrote: > > I think the idea that value types should be objects would > > require stretching the notion of object too far, and violate one of > > the fundamental properties that objects currently have. > > Certainly this was the idea, though I didn't

Re: typed objects and value types

2014-04-02 Thread Brandon Benvie
On 4/2/2014 8:01 AM, Andreas Rossberg wrote: That is very helpful, thanks! I agree with a lot with what you say. But to expand on my reply to your blog post, I have one fundamental concern: I think the idea that value types should be objects would require stretching the notion of object too far,

Re: typed objects and value types

2014-04-02 Thread Niko Matsakis
> I think the idea that value types should be objects would > require stretching the notion of object too far, and violate one of > the fundamental properties that objects currently have. Certainly this was the idea, though I didn't think of it is as violating, but rather... stretching. :) > Oth

Re: typed objects and value types

2014-04-02 Thread Andrea Giammarchi
quick feedback 1. paper: all Cartesian examples forget to retrieve/assign this.x and this.y, i.e. `Cartesian . prototype .toPolar = function() {var r = Math.sqrt(x*x + y*y);}` ... I can guess those are initial own properties but after reading all examples without context I started doub

Re: Module "Shimming"

2014-04-02 Thread Guy Bedford
On 1 April 2014 11:08, Jacob Gable wrote: > I was wondering if anyone has any thoughts/approaches on shimming non ES6 > modules. I've run into two different approaches so far and there doesn't > seem to be much guidance around the process. > > To be clear, all I'm talking about right now is what

Re: typed objects and value types

2014-04-02 Thread C. Scott Ananian
Commenting on this same region: ``` print(points[0].x); // 0 to start points[0].x = 1; print(points[0].x); // still 0 points[0] = {x: 1, y: 2}; print(points[0].x); // now 1 ``` There's no reason why we couldn't extend the grammar to handle this case, in the same way that `a.f()` has different sema

Re: typed objects and value types

2014-04-02 Thread Mark S. Miller
I just got to the Appendix B at the end of your article, so I see you were aware of the strictness issue. The semantics of a failed assignment to a field of a value type should indeed just be the semantics of a failed assignment: if the assignment is performed by sloppy code, the failure is silent.

Re: typed objects and value types

2014-04-02 Thread Domenic Denicola
I really appreciate you guys making === (not just ==) work for value types. I think that drastically improves the usability compared to earlier proposals. I can see Andreas's concerns regarding what that means for their object-ness though. But hopefully that can be worked out while still keeping

Re: typed objects and value types

2014-04-02 Thread Mark S. Miller
On Wed, Apr 2, 2014 at 7:32 AM, Niko Matsakis wrote: > I just wanted to let people on es-discuss know about two of my recent > blog posts concerning typed objects. The first is a kind of status > report: > > > http://smallcultfollowing.com/babysteps/blog/2014/04/01/typed-objects-status-report/ >

Re: typed objects and value types

2014-04-02 Thread Dmitry Lomov
On Wed, Apr 2, 2014 at 5:01 PM, Andreas Rossberg wrote: > > Other properties, like the ability to use an object as keys in weak > collections, follow from that. If we suddenly allowed objects that do > not have identity, but a structural notion of equality, then we could > not allow these objects

Re: typed objects and value types

2014-04-02 Thread Andreas Rossberg
On 2 April 2014 16:32, Niko Matsakis wrote: > I just wanted to let people on es-discuss know about two of my recent > blog posts concerning typed objects. The first is a kind of status > report: > > http://smallcultfollowing.com/babysteps/blog/2014/04/01/typed-objects-status-report/ > > and the se

typed objects and value types

2014-04-02 Thread Niko Matsakis
I just wanted to let people on es-discuss know about two of my recent blog posts concerning typed objects. The first is a kind of status report: http://smallcultfollowing.com/babysteps/blog/2014/04/01/typed-objects-status-report/ and the second details some (preliminary) thoughts on how one could