Open chaoticbob opened 1 week ago
Slang does not support function declaration. Slang allows out of order definitions so declaration is not needed. Declaring a function without implementation and provide the implementation in a different place is not a supported language feature.
I glanced at the function section of the docs and didn't see any mention of out of order definition (or maybe I'm looking in the wrong spot?). If it's not in there, it would be helpful to have an explanation and some examples.
The user guide explains that the forward declaration is not needed.
One source file in a translation unit may freely refer to declarations in another source file from the same translation unit without any need for forward declarations.
That is a single sentence in a relatively obscure part of the documentation to discuss functions. At the very least, the Function section of the documentation should mention the scoping behavior with in the same source file and refer to that Compiling section for more information on behavior within source units/modules.
I agree that it should be documented better.
Changing the labe to to documentation
For the shader below, Slang current generates the following error due to the implementation of
A::B::AddBlue()
andA::AddGreen()
living outside the namespace:I couldn't find an example in the tests of something similar.
Shader