We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
MethodScript currently does not have a method to cast to any desired type. This makes it impossible to fully statically type programs such as:
mixed @a = ...; if(@a instanceof array) { array @arr = @a; // Typecheck error, need to insert a cast. }
cast(mixed, classtype)
ClassCastException
(type) expression
cast(expression, type)
Note that MethodScript currently does have integer(mixed), string(mixed), boolean(mixed) and double(mixed) that all cast to one specific type.
integer(mixed)
string(mixed)
boolean(mixed)
double(mixed)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Problem
MethodScript currently does not have a method to cast to any desired type. This makes it impossible to fully statically type programs such as:
Proposed solution
cast(mixed, classtype)
function that casts the given mixed to the given classtype, or throws aClassCastException
when it can't.(type) expression
syntax that compiles tocast(expression, type)
.Note that MethodScript currently does have
integer(mixed)
,string(mixed)
,boolean(mixed)
anddouble(mixed)
that all cast to one specific type.The text was updated successfully, but these errors were encountered: