Giter Club home page Giter Club logo

Comments (8)

mhevery avatar mhevery commented on March 28, 2024

@vicb Please let us know when you can start working on it.

from angular.

vojtajina avatar vojtajina commented on March 28, 2024

new syntax that we agreed on...

class Foo {

  @FINAL('bar,name,age')
  @CONST
  constructor(age: number, name: string) {
    this.bar:boolean = true;
    this.name:string = 'Hello ' + name;
    this.age = age;
  }
}

get transpiled into....

class Foo {

  final int age;
  final String name;
  final bool bar;
  const Foo(int age, String name) : bar = true, age = age, name = 'Hello ' + name {
    // Note how final fields have been hoisted into the "initializer", after the colon.
  }
}

from angular.

vicb avatar vicb commented on March 28, 2024

What would be the purpose of the @FINAL here ? All fields have to be final with a constant constructor.

@FINAL could be useful for non-const ctor to force members to be final. What about @FINAL(['bar', 'name', 'age']) ? In a second step the final modifier could probably be added automatically by visiting the class. If we agree on this we should probably evaluate the effort of writing the "final transfomer" and if it is not too complex then skip the intermediate @FINAL. What do you think ?

side notes:

  • age should probably be a num, see #17
  • I think that a const ctor could not have a body in Dart then the transpiled code from the previous post is not valid, there should be a ";" after the initializer list

from angular.

vicb avatar vicb commented on March 28, 2024

@mhevery I want to fix #24 before and then I'll start working on this issue. Probably later today or tomorrow.

from angular.

vojtajina avatar vojtajina commented on March 28, 2024

+1 for Making all fields final by default if the constructor is const

As for your sidenotes: yes, yes.

from angular.

mhevery avatar mhevery commented on March 28, 2024

@vicb [https://github.com//issues/11#issuecomment-57293151] sounds good to me, also agree with @vojtajina and making @FINAL optional.

from angular.

usernamealreadyis avatar usernamealreadyis commented on March 28, 2024

:shipit:🔫

from angular.

angular-automatic-lock-bot avatar angular-automatic-lock-bot commented on March 28, 2024

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

from angular.

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.