-
Notifications
You must be signed in to change notification settings - Fork 126
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
Enumerations with explicit strides #1087
Comments
The idea here is that it might be nice to specify the stride explicitly rather than inferring it from expressions like |
Fully agree. Not only are the types better, but I think it is more readable too. It might be nice to use a keyword or something to indicate the direction "up" or "down" to avoid having to deal with negative numbers (for the corner case where the step is a type variable) |
Just as a datapoint: VHDL allows users to specify index ranges in either direction with the syntax |
I haven't checked how this plays with the parser yet, but I'm thinking syntax like the following for expressing positive strides. This syntax would incur the obligations that
Here the edge case is a bit more subtle than with For descending sequences, I'm less sure what we want exactly. Which of the following possible variations would we want?
I suppose we could also have these, for infinite sequences.
|
Thinking about it some more, the |
Playing with the parser a bit, it seems like we'll need to make |
Fixed via #1227 |
The additional thing that might be nice is other options for specifying "down from" enumerations other than the current
[n, n-1, ... 0 ]
syntax. One problem with this is thatn-1
requiresn >= 1
. Maybe something like[n .. 0 by -1 ]
, so you can explicitly set the stride, which is usually what you care about anyway.Originally posted by @robdockins in #973 (comment)
The text was updated successfully, but these errors were encountered: