GithubHelp home page GithubHelp logo

Constructor decorators about proposal-decorators HOT 6 OPEN

tc39 avatar tc39 commented on August 16, 2024
Constructor decorators

from proposal-decorators.

Comments (6)

bmeck avatar bmeck commented on August 16, 2024

I'd would prefer to leave it for a follow on.

That said, I do like to delete MyClass.constructor somewhat often so it is tempting.

from proposal-decorators.

littledan avatar littledan commented on August 16, 2024

Hmm, we might be able to accommodate that particular case, by putting the constructor property in the elements list (as a "prototype method")... then a @noconstructor class decorator could remove that. Thoughts?

from proposal-decorators.

ljharb avatar ljharb commented on August 16, 2024

I think for now you could do that with a class decorator, since the class is the constructor function, no?

from proposal-decorators.

littledan avatar littledan commented on August 16, 2024

You mean with a finalizer which deletes the property? Yes, that is possible already, you are right.

from proposal-decorators.

jsg2021 avatar jsg2021 commented on August 16, 2024

@bmeck What does that do? Block the class from being instantiated?

from proposal-decorators.

erights avatar erights commented on August 16, 2024

With @noconstructor, access to an instance no longer automatically implies access to that instance's constructor. IOW, for @noconstructor class Foo, I can give you access to an instance of Foo while denying you access to the Foo constructor, i.e., to the class object.

from proposal-decorators.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.