Re: constructor, super, and data members issue

2018-09-04 Thread Ranando King
ll work as expected. >>>> >>>> On Thu, Aug 30, 2018 at 4:38 PM doodad-js Admin >>>> wrote: >>>> >>>>> I'm late to the party, but I've found a solution for my non-loved >>>>> framework : have another constructor called befo

Re: constructor, super, and data members issue

2018-09-03 Thread Jordan Harband
ut I've found a solution for my non-loved >>>> framework : have another constructor called before "super", which fills a >>>> faked "this" and a faked "args" then replicated values to "this" after >>>> doing "super(..

Re: constructor, super, and data members issue

2018-09-03 Thread Ranando King
;, which fills a >>> faked "this" and a faked "args" then replicated values to "this" after >>> doing "super(...fakedArgs)". >>> >>> >>> https://github.com/doodadjs/doodad-js/blob/v9.1.3/src/common/Bootstrap.js#L5320

Re: constructor, super, and data members issue

2018-09-03 Thread Jordan Harband
;> https://github.com/doodadjs/doodad-js/blob/v9.1.3/src/ >> common/Bootstrap.js#L5320-L5330 >> >> -Original Message- >> From: Isiah Meadows >> Sent: Sunday, August 26, 2018 3:29 PM >> To: Logan Smyth >> Cc: Ben Wiley ; es-discuss <

Re: constructor, super, and data members issue

2018-09-03 Thread Ranando King
;super", which fills a >> faked "this" and a faked "args" then replicated values to "this" after >> doing "super(...fakedArgs)". >> >> >> https://github.com/doodadjs/doodad-js/blob/v9.1.3/src/common/Bootstrap.js#L5320-L5

Re: constructor, super, and data members issue

2018-09-03 Thread Ranando King
tstrap.js#L5320-L5330 > > -Original Message- > From: Isiah Meadows > Sent: Sunday, August 26, 2018 3:29 PM > To: Logan Smyth > Cc: Ben Wiley ; es-discuss < > es-discuss@mozilla.org> > Subject: Re: constructor, super, and data members issue > > Yeah, I was

RE: constructor, super, and data members issue

2018-08-30 Thread doodad-js Admin
ps://github.com/doodadjs/doodad-js/blob/v9.1.3/src/common/Bootstrap.js#L5320-L5330 -Original Message- From: Isiah Meadows Sent: Sunday, August 26, 2018 3:29 PM To: Logan Smyth Cc: Ben Wiley ; es-discuss Subject: Re: constructor, super, and data members issue Yeah, I was more focused on

Re: constructor, super, and data members issue

2018-08-26 Thread Isiah Meadows
Yeah, I was more focused on the static class side of things, because I thought they were referring to that. Class instance fields are different, and so of course, those are never set on the prototype unless for whatever reason, the parent constructor returns `Object.getPrototypeOf(this)` instead

Re: constructor, super, and data members issue

2018-08-26 Thread Logan Smyth
Static class fields run their initializers and define the properties at declaration time, and class constructors have the parent class as the `[[Prototype]]`, so static field values are inherited. I think this is adding to confusion though, because while that's absolutely true, that is not

Re: constructor, super, and data members issue

2018-08-26 Thread Isiah Meadows
Every object, including functions, have an internal prototype. Functions normally have one set to `Function.prototype`, and objects normally inherit from `Object.prototype` at least indirectly. But because of how prototypes work, the only requirement for something to be used as a prototype is that

Re: constructor, super, and data members issue

2018-08-25 Thread Ben Wiley
How can they be prototypically inherited if they don't live on the prototype? I feel like I'm missing something. Le sam. 25 août 2018 19 h 53, Isiah Meadows a écrit : > Class fields are prototypically inherited just like via `Object create`. > This is more useful than you might think, and it's

Re: constructor, super, and data members issue

2018-08-25 Thread Isiah Meadows
Class fields are prototypically inherited just like via `Object create`. This is more useful than you might think, and it's the main reason anyone actually cares about static fields beyond namespacing. On Sat, Aug 25, 2018 at 14:36 Ben Wiley wrote: > All this just reminds me of *my opinion* that

Re: constructor, super, and data members issue

2018-08-25 Thread Ben Wiley
All this just reminds me of *my opinion* that class fields is a borrowed concept from statically typed languages that is misplaced in a dynamically typed languages like JavaScript. In C++ I use class fields to declare what properties will be allocated and instantiated when a new class member is

Re: constructor, super, and data members issue

2018-08-25 Thread Augusto Moura
24-08-2018 19:29, Aaron Gray : > > Yeah it does look like its badly "broken by design". > Why this behaviour is broken? Every OOP language that I worked with behaves de same way, and there's not many developers complaining about it. If you want to use a property that might be overrided in a

Re: constructor, super, and data members issue

2018-08-25 Thread Allen Wirfs-Brock
Base cases that take dependencies upon information potentially supplied by subclass have to be intentionally design to make that work. And the chosen design should be document as part of its subclassing contract. For the example shown there is there is a long known pattern that can be used:

Re: constructor, super, and data members issue

2018-08-25 Thread Aaron Gray
On Sat, 25 Aug 2018 at 00:35, Logan Smyth wrote: > Generally if something is required during construction, it would be best > to pass it down as part of the constructor options. For example, you could > do > ``` > class Base { > constructor({ idAttribute = "id"}) { > this.idAttribute =

Re: constructor, super, and data members issue

2018-08-24 Thread Jordan Harband
Personally I think a design where the superclass relies on any part of the subclass is "broken by design"; but certainly there's ways you can achieve that. On Fri, Aug 24, 2018 at 4:34 PM, Logan Smyth wrote: > Generally if something is required during construction, it would be best > to pass it

Re: constructor, super, and data members issue

2018-08-24 Thread Logan Smyth
Generally if something is required during construction, it would be best to pass it down as part of the constructor options. For example, you could do ``` class Base { constructor({ idAttribute = "id"}) { this.idAttribute = idAttribute; } } class Derived extends Base { constructor() {

Re: constructor, super, and data members issue

2018-08-24 Thread Aaron Gray
Yeah it does look like its badly "broken by design". On Fri, 24 Aug 2018 at 22:13, Jordan Harband wrote: > I'm afraid that still wouldn't solve the problem; the superclass's code is > all 100% completed before the subclass has `this` available. > > On Fri, Aug 24, 2018 at 1:52 PM, Ranando King

Re: constructor, super, and data members issue

2018-08-24 Thread Jordan Harband
I'm afraid that still wouldn't solve the problem; the superclass's code is all 100% completed before the subclass has `this` available. On Fri, Aug 24, 2018 at 1:52 PM, Ranando King wrote: > Aaron, congratulations! You just tripped over a new reason for me to > revive issue #123. The only way

Re: constructor, super, and data members issue

2018-08-24 Thread Ranando King
Aaron, congratulations! You just tripped over a new reason for me to revive issue #123. The only way to get that to work is to have the default values on the prototype. The problem comes because `this` doesn't even have a value until the last call to `super()` returns. If a `class` doesn't have a

constructor, super, and data members issue

2018-08-24 Thread Aaron Gray
I am having an issue with order semantics regarding https://github.com/tc39/proposal-class-fields with derived classes defining or overriding data member values that are used in the base class constructor for initialization of properties of the class. This means the Super Class / Base Class'es