-
Notifications
You must be signed in to change notification settings - Fork 456
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
HGS loops don't behave as expected #1320
Comments
I'm surprised that someone would delve so deeply into the hgs language, which was originally intended only for hdl templates and then rather accidentally reused for generic circuits. 😄 The too wide scope in the repeat and while body is rather a bug and very easy to fix. Break and continue are more difficult to add, and since I'm not a fan of either, I'd rather avoid the added complexity. |
What can I say, I'm an irredeemable tinkerer :)
My use case is generic circuits (though I've poked around in the hdl templates in the code base while exploring integrating with custom executables). Once I got used to the scripting language, I found it useful not just for parameterized components and building out repetitive structures, but also for pre-computing large and/or complex lookup tables. (Or really any combination of those concerns).
I'll agree to disagree about the utility of I don't expect the final solution would be significantly more complex, though, and I'm more than happy to push forward on it and at least share my work with you if there's any chance you're not dead-set on keeping those keywords out of the language. |
while
andrepeat
loops should behave more in line with expectations carries from other procedural languages. In particular, it should be possible to declare a new variable within the scope introduced by the loop body. This is currently not possible because theContext
s built for their inner scopes are re-used, and the interpreter sees a redeclaration upon the second iteration.P.S.
break
andcontinue
would also be really nice to have.P.P.S. I threw together a simple implementation for all of this if you're interested.
The text was updated successfully, but these errors were encountered: