Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert to *.prototype.is* = true #21293

Merged
merged 2 commits into from
Feb 16, 2021
Merged

Revert to *.prototype.is* = true #21293

merged 2 commits into from
Feb 16, 2021

Conversation

mrdoob
Copy link
Owner

@mrdoob mrdoob commented Feb 16, 2021

Related issue: #21284 #21285

@mrdoob mrdoob added this to the r126 milestone Feb 16, 2021
@mrdoob mrdoob merged commit f23d9e0 into dev Feb 16, 2021
@mrdoob mrdoob deleted the es6 branch February 16, 2021 23:54
@DefinitelyMaybe
Copy link
Contributor

DefinitelyMaybe commented Feb 17, 2021

I think I might've confused you and this whole situation. Could someone else please provide some clarity for the related issues.

never mind my guess then

my guess is that:

class foo {
  bar = 1
}

is equivalent to:

class foo {}

foo.prototype.bar =1

@mrdoob
Copy link
Owner Author

mrdoob commented Feb 17, 2021

No. It's not equivalent.

@DefinitelyMaybe
Copy link
Contributor

I'm at a loss on this one. The following works fine in the browser and if I'd understood that earlier I wouldn't have worried about changing as much around as I did with my movements towards classes. We could have gone slower. I apologize @mrdoob.

class foo {
  constructor(param) {
    this.thing = param
  }
}

foo.prototype.value = 1

Object.assign(foo.prototype, {a:'...'})

class bar extends foo { }

Object.assign(bar.prototype, {a:"... ..."})

const y = new foo("aaa")
console.log(y.value);
console.log(y.a);
console.log(y.thing);

const x = new bar("dsa")
console.log(x.value);
console.log(x.a);
console.log(x.thing);

logs:

1
"..."
"aaa"
1
"... ..."
"dsa"

an earlier comment

@DefinitelyMaybe
Copy link
Contributor

#21294

@linbingquan
Copy link
Contributor

There has Object.defineProperty( this, 'is, shell we change it?

image

@mrdoob
Copy link
Owner Author

mrdoob commented Feb 18, 2021

@linbingquan Actually, I think that'd be great. Please, go ahead and clean that up 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants