-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Makes finalVarOrType mandatory for the typedef #270
Comments
Removed Type-Defect label. |
Added apr30-triage label. |
Removed apr30-triage label. |
Added triage1 label. |
We now have mixin-application typedefs. |
Removed this from the Later milestone. |
Removed Oldschool-Milestone-Later label. |
Closed incorrect issue, this one is still open. |
This is stale now that we have the new function syntax. |
This issue was originally filed by [email protected]
typedef use formalParameterList for declare an alias of function type.
But this rule surprise many users.
For example.
int f( int x ) => x ;
typedef int type( int ) ;
void main()
{
type t = f ;
t("a") ; // no static type warning is issued.
}
This is because int is treated as an identifier in simpleFormalParameter.
So int is just a name of parameter and its type is Dynamic.
But most user who don't read spec expect above typedef to annotate that the static type of parameter is int.
That's why they surprise the above code doesn't issue a static type warning.
To solve this issue, I propose to make finalVarOrType in mandatory for the typedef.
Under the proposed change, above typedef must be rewritten as
typedef int f( var int ) ;
This makes it apparent for all users that int is just a name of parameter and its type is Dynamic since it use var.
The text was updated successfully, but these errors were encountered: