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

Can Dex actually allow question marks in array sizes? #947

Open
axch opened this issue Jun 9, 2022 · 3 comments
Open

Can Dex actually allow question marks in array sizes? #947

axch opened this issue Jun 9, 2022 · 3 comments

Comments

@axch
Copy link
Collaborator

axch commented Jun 9, 2022

I tried to define a function specialized to a flat array with an anonymous (unknown) size, like so:

def fin_mean (xs: (Fin _)=>Float) : Float =
  mean xs

and I got this:

Not implemented:
Please report this at github.com/google-research/dex-lang/issues

Type inference of this program requires delayed interface resolution

def fin_mean (xs: (Fin _)=>Float) : Float =
                   ^^^^^^^^^^^^^

This doesn't block anything for me, because it's easy enough to just add the implicit Nat argument to serve as a name for the size, but the gap seems unaesthetic.

@apaszke
Copy link
Collaborator

apaszke commented Jun 13, 2022

Well, a type annotation is an expression, so whenever you say _ it means "this can be inferred". But in this case it can't, because there's nothing to provide the size of xs! I read your issue as expecting _ to automatically make the function polymorphic, but _ never introduces any more binders/polymorphism!

@axch
Copy link
Collaborator Author

axch commented Jun 13, 2022

Hm. Then "not implemented" is probably not a good error message.

@apaszke
Copy link
Collaborator

apaszke commented Jun 14, 2022

I agree it's not good. But putting an extra inference variable in there does hit a not implemented case in inference, so it's also true. We used to support this before safer names, but not anymore.

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