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
Possible bug with using a @meta value more than once #54
Comments
This is a thorny aspect of C++. Member function definitions are parsed after the enclosing class definition is completed. Like, the closing brace of MyStruct is hit, then the compiler has to go back and parse the function definitions. This makes metaprograming of member functions from meta control flow in the class definition extremely tricky. That That is probably where this issue is. What are you trying to achieve? There may be some more robust way to approach that, or maybe a different way to do metaprogramming inside class definitions. |
Huh, interesting. That explains the wording of the error message. Still, shouldn’t the memoized object be able to be used as many times as you want within the member function? As for what I was trying to achieve, nothing important. Trying to synthesize vector swizzle functions, like |
Oh, ya well it is a bug. BTW, I have vector swizzles as a language builtin: |
Ah, ok. We’re on the same page then. Yep, I know they are built in. I was just fooling around with Circle’s metaprogramming features. |
Thanks for the report. Fixed for build 139. Will upload that tomorrow or Monday. |
The code below fails to compile for me with the error
memoized meta object int 'val' is not a portable type
. Originally found this when trying to do something more interesting, with a@meta
loop instead of a block, and a loop variable instead of@meta int val = 0
. Removing one of the@meta val
statements makes the error go away.P.S. Great work on Circle! Found out about it last week. Many of the features (simple compile-time metaprogramming, single-source shaders, etc.) are things I've been wishing for in a programming language for a long time, so it's been really cool to actually be able to try some of them out.
The text was updated successfully, but these errors were encountered: