-
Notifications
You must be signed in to change notification settings - Fork 41
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
#import "file" without list of names should err/warn #97
Comments
It would make sense for this to be an “unused” warning. It isn’t failing, it’s just not necessary since we added the ability to refer to fully qualified items without importing. If you don’t import any items you’re importing the module, which means you can use items from it with |
Oh, also to note, particularly for custom bevy shaders which are quoted like your “common.wgsl” it’s useful to alias them - |
I didn't even know such syntax existed. The readme doesn't explain the "file" case. |
Which bit is not explained? I thought it was all in there. |
The readme has examples for https://docs.rs/naga_oil/ has nothing about imports and looks empty. |
Ah, right. The treatment/resolution of quoted names is bevy-specific, naga oil itself doesn’t treat quoted names any differently. |
Do you think naga should get a first-class support for path names, or should complain about handling of these to Bevy? |
i think path names is way out of scope for naga. could you clarify what it is about bevy's handling you don't like? |
In Bevy, I don't like that there's no warning/error when the import directive is useless. I've wasted a lot of time trying to use includes incorrectly, and was puzzled why nothing is included even though the |
Ok. So as I mentioned we could add a warning, but I don’t personally think it’s necessary.
|
To be clear, if you (or anyone else) wanted to make a pr to emit a warning, I wouldn’t object, I just don’t plan to do it myself. |
Rust-like Which is why I'm asking whether this should be changed in naga or Bevy, assuming that |
Import “file”::item does indeed work, as does using “file”::item inline in the shader code. The quotes are a bevy-specific thing, naga_oil doesn’t interpret quoted names in any special way (though we have made some efforts to allow them to be used). |
Import with a file path, but without a list of names, "fails" silently:
This syntax is very similar to C's
#include
that just imports everything, so I did not think of specifying individual type names, and was puzzled why this directive doesn't seem to do anything, and doesn't even cause a compilation error.The text was updated successfully, but these errors were encountered: