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

Idempotent constructor #18

Open
mikolalysenko opened this issue May 22, 2015 · 2 comments
Open

Idempotent constructor #18

mikolalysenko opened this issue May 22, 2015 · 2 comments

Comments

@mikolalysenko
Copy link
Member

Would be nice if ndarray could take any ndarray-ish object and automatically coerce it to an ndarray. For example, if you feed it any object with data,shape,stride,offset properties, it should convert it into an ndarray with the correct interface automatically.

@mikolalysenko
Copy link
Member Author

Pros:

  • This would allow for a new pattern where libraries construct ndarrays immediately, thus protecting themselves from possible API breakages and ensuring stability
  • It would also simplify the problem of marshalling ndarrays, since a plain old JS object could be directly converted with this style.
  • It would not break backwards compatibility in any existing ndarray code.

Cons:

  • This is a minor version bump, and would break the promise of freezing the API

@rreusser
Copy link
Member

In lieu of this, is there a nice clean already-existing way to serialize/deserialize an ndarray? It looks possible to make one with something like typedarray-to-buffer, but I'd rather not if it already exists.

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

2 participants