feat: support type infer for class memeber#2880
Conversation
|
Is there any existing code that can be used instead of this, such as (perhaps) whatever code is responsible for let/const?
Adding a new AST node just for this, and then creating a type from it based off of the NodeKind of the expression, makes me a bit uncomfortable, especially since no other type-related AST node contains arbitrary expressions within it (aside from IdentifierExpressions).
Ultimately, it's your call to make, but I'm wondering if there's a better solution?
|
We definitely need a node like We have 2 solutions. one is I think |
|
@CountBleck WDYT? |
|
I think I've expressed my dislike for CompiledExpression before. It's most likely better to avoid that sort of thing if possible.
…On Thursday, October 31st, 2024 at 9:20 AM, Congcong Cai ***@***.***> wrote:
***@***.***(https://github.com/CountBleck) WDYT?
—
Reply to this email directly, [view it on GitHub](#2880 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/AS434PFYZK2TGZSDMEJV6UDZ6JKENAVCNFSM6AAAAABQW646BKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJQGI4TCOBRGY).
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
I agree with you. Then the question is should we follow the current design and patch the AST / Resolver / Compiler to do type inferring or we design a new mechanism and introduce new process during compilation. It may introduce a huge change for Class and Function elements. |
It introduce a new internal mechanism in resolver to infer the expression type without
Flow. Just likedecltype()in C++ to support more flexible class definition.