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

Array size unification instead of inference from index constraints #15

Open
jleben opened this issue Oct 14, 2019 · 0 comments
Open

Array size unification instead of inference from index constraints #15

jleben opened this issue Oct 14, 2019 · 0 comments
Labels

Comments

@jleben
Copy link
Owner

jleben commented Oct 14, 2019

There might be an alternative to the complex array size inference from index constraints. The following might be simpler, more intuitive and still powerful enough:

For each array dimension, if bound is not provide in an array definition, then assume one from the context:

  1. Explicit type annotation:
a :: [5]int
a[i] = i * 2;

This would also simplify piecewise array definition using equations - avoid repeating constraints for array bounds. E.g. avoid repeating j < 5 in the following:

a :: [~,5]int
a[i,j] = 0 if i < j;
a[i,j] = log(i-j);
  1. Context of array expression - x[1] has size [5], because it must have the same size as x[0]:
x = [0 -> [5: i -> i], 1 -> [j -> j]]

This would make obsolete issues #1, #3.

@jleben jleben added the idea label Nov 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant