-
Notifications
You must be signed in to change notification settings - Fork 44
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
File of constants not generating any code, causes compile error #196
Comments
It actually doesn't look like const values are generating any code at all? |
I have a POC solution for this. The approach I took was, given a file "foo.thrift" with a non-empty set of constants, generate a module called
|
It definitely should generate something for constants -- only reason it doesn't is that we hadn't gotten to it. Naming it is tricky. Using the filename as you suggested, foo.thrift and subdir/foo.thrift would both generate a FooConstants module. Using the namespace, same thing, multiple thrift files can contain the same namespace. I think I favor generating a module based on the namespace though because we have more control over it. We have a bunch of thrift files that we can't easily move around or rename, but all these other systems depend on them and they include each other, but we can add I know you have the separate issue with Apache raising errors about unrecognized namespaces. We need to fix that somehow. Regarding macros vs functions, I liked macros for enums because they're so often used for matching. For constants, maybe it doesn't make as much difference. You can always put the function call in a variable or module attribute or unquote if you really need to match it, but it seems like it would happen less often. What do you all think? |
I'm seeing some of the issues that @pguillory mentions in the previous comment with the current approach to generating constants. Start with a file named I'm not quite sure what should change, but it's a bit confusing, and I suppose we could run into problems on case-insensitive file systems. I suppose we could look at merging the constants into |
(On thrift_tng)
The compile error is
The error appears to occur in this function in the compile task when
targets
comes back as an empty list:The file I'm parsing just contains some
const i32
definitions that aren't referenced in the other thrift files anywhere (they get used in applications that use this set of thrift files). If I pass--force
to the compiler, it gets past this stage but then my library fails to compile because the constants are undefined.I'll try to come up with a test case that exercises this and if I see an easy fix I'll make a PR.
The text was updated successfully, but these errors were encountered: