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

Replace Nothing with Missing #29

Open
Tokazama opened this issue Nov 28, 2021 · 3 comments
Open

Replace Nothing with Missing #29

Tokazama opened this issue Nov 28, 2021 · 3 comments

Comments

@Tokazama
Copy link
Collaborator

We've used the convention of returning nothing when something isn't known at compile time (e.g., known(1) == nothing). I think it might actually make more sense to use missing. A minor motivation for this could be that the "known" information is "missing" at compile time, so it has a more clear meaning. But I think the biggest benefit is that you can still operate on return from known. For example, ArrayInterface.known_length(x) = prod(known_size(x)) would work.

This would be a breaking change and could require some extra work down stream, so I want to get opinions on this before getting a bunch of PRs ready.

@JeffreySarnoff
Copy link
Contributor

Would it make more sense to expand known so known(x) where !is_static(x) is x?

@Tokazama
Copy link
Collaborator Author

Tokazama commented Dec 4, 2021

Do you mean that known(1) == 1 and known(static(1)) == 1? This is what dynamic does. I usually use known on types so that known(Int) === nothing and known(StaticInt{1}) === 1. This is useful for pulling type info down into a useable form, so I'm not sure we'd want to return Int in the scenario.

@JeffreySarnoff
Copy link
Contributor

JeffreySarnoff commented Dec 4, 2021

I understand that, and I use dynamic for the same purpose.
Rereading your initial note, I agree that it makes sense to enable
ArrayInterface.known_length(x) = prod(known_size(x)) and any other otherwise unavailable definitions.

so +1

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