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

runtime crash with "Numeric" #2583

Open
ghost opened this issue Nov 18, 2017 · 2 comments
Open

runtime crash with "Numeric" #2583

ghost opened this issue Nov 18, 2017 · 2 comments

Comments

@ghost
Copy link

ghost commented Nov 18, 2017

var c:Numeric =233
var b:Numeric =1.0
print c+b

In this simple case it could be detected by the compiler but in the general case it should be handled somehow. If it crashes or throws a runtime exception it means the Numeric type is useless and dangerous.

@xymus
Copy link
Contributor

xymus commented Nov 22, 2017

The plan is to support operator overloading to implement Int + Float and others, in order to get the desired behavior at an acceptable performance level.

Until then, I recommend not using explicitly the Numeric static type if you don't need it, the Numeric limitations should not affect the direct use of Float and Int. You probably already noticed, in the given example simply removing the two :Numeric types will result in the expected static error to be displayed. But if you do need to use Numeric, use it with the Numeric-safe (but slower) methods add, sub, etc.

@ghost
Copy link
Author

ghost commented Nov 22, 2017 via email

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