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

Usage of unsupported type causes runtime error #177

Open
fekazar opened this issue Oct 30, 2023 · 1 comment
Open

Usage of unsupported type causes runtime error #177

fekazar opened this issue Oct 30, 2023 · 1 comment
Labels
api Common api

Comments

@fekazar
Copy link

fekazar commented Oct 30, 2023

The following code will compile, but cause the runtime error because inferred type is Number which is unsupported.
val b = mk.ndarray(mk[1.0, 2]). Considering current library design, is it possible to move this check to compile time? Maybe numbers should be treated as Double?

@devcrocod
Copy link
Collaborator

The mk[...] construct is simply a list. While it's possible to convert the types to a common type, it's currently a substantial effort for a minor benefit. This is because we'd need to first determine the larger type and then convert the remaining types to it, all while optimizing the process. I already have a task on my plate to create a parser for external data reading. Once I add that, it should address and close this issue as well.
It's worth considering whether this approach is the right choice at all. Since it exhibits non-intuitive behavior, users may be surprised by the high memory consumption.

And for now, I agree that it might be a good idea to add validation and throw a runtime exception

@devcrocod devcrocod added the api Common api label Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Common api
Projects
None yet
Development

No branches or pull requests

2 participants