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

[design] nullary class application #24

Open
xieyuheng opened this issue Sep 7, 2022 · 1 comment
Open

[design] nullary class application #24

xieyuheng opened this issue Sep 7, 2022 · 1 comment

Comments

@xieyuheng
Copy link
Member

Problem:

In js/ts there are new User() and new User.

How should we handle nullary applications?

@xieyuheng xieyuheng changed the title [design] nullary function application and class application [design] nullary class application Sep 7, 2022
@xieyuheng
Copy link
Member Author

Solution 1:

Do not support nullary class application.

Because from the following example, we see that,
new ABC() is only useful when all properties are fulfilled.

class ABC {
  a: String = "a"
  b: String = "b"
  c: String = "c"
}

check new ABC(): ABC

But in this case, we can simply use object:

let abc = {
  a: "a",
  b: "b",
  c: "c",
}

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

No branches or pull requests

1 participant