-
-
Notifications
You must be signed in to change notification settings - Fork 411
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
Conditional code #8
Comments
Conclusion of long discussion:
|
This is in the code generator now. It works with if expressions and anything the compiler can determine to be a constant expression, so you can combine Platform booleans with other booleans, and if that results in a branch that can never execute, that branch won't be generated. This isn't implemented for while loops. Andy, that leaves the "use lib" conditional guard implementation to you. |
The "lib:" handler for use commands isn't in yet, but the conditional guards are. I've actually made it so that all use commands can have a condition, including using packages. The condition is evaluated in the scope pass (ie where we already handled use commands). If the condition fails we pretend that use command doesn't exist. This allows entire packages to be platform specific if you want to. |
We need to allow conditional code, both platform / hardware specific and for debug vs release.
We could switch at the expression, method, type or file level.
We need to provide system / build info (OS, CPU capabilities, debug / release).
Should we also allow programmer configurable info? This could be to allow the aardvark build to be different to the wombat build. It could also be used to make complex decisions based on OS, CPU, etc jsut once, rather than in every file, function, etc.
The text was updated successfully, but these errors were encountered: