It will always return paths to the file the function is contained in. Calling it from another file will then return a path relativ to the imported file, wherever it may be
Ok that’s clear, but I do not understand why creating two functions go against that intent. If they aren’t public what’s the difference between one or two?
I think is only a matter of style (and yeah, I also prefer the break, is more concise for that specific case). Please let me know if I’m wrong and is also semantically different.
Sorry for the questions I’m just trying to fill the gaps in my zig knowledge
Ok that’s clear, but I do not understand why creating two functions go against that intent. If they aren’t public what’s the difference between one or two?
You will have another symbol in your scope that isn't general purpose, so you pollute your namespace. That's all. Keep symbol count low unless you really need the stuff twice is what i'm trying to do
Super cool! Thanks for the reply. But by not being public couldn’t the compiler inline the function and avoid producing a symbol? By the end the compiler should know that the only point where the function is called is inside that source (if you place the pub keyword that’s a different story)
Isn’t it?
I'm talking about a semantic symbol/name in a scope, not what's emitted in the binary. You cannot call something else in that file concatenate for example, even if you might need it
Wdym with “isn’t portable between files“?
It will always return paths to the file the function is contained in. Calling it from another file will then return a path relativ to the imported file, wherever it may be
Ok that’s clear, but I do not understand why creating two functions go against that intent. If they aren’t public what’s the difference between one or two?
I think is only a matter of style (and yeah, I also prefer the break, is more concise for that specific case). Please let me know if I’m wrong and is also semantically different.
Sorry for the questions I’m just trying to fill the gaps in my zig knowledge
You will have another symbol in your scope that isn't general purpose, so you pollute your namespace. That's all. Keep symbol count low unless you really need the stuff twice is what i'm trying to do
Super cool! Thanks for the reply. But by not being public couldn’t the compiler inline the function and avoid producing a symbol? By the end the compiler should know that the only point where the function is called is inside that source (if you place the pub keyword that’s a different story)
Isn’t it?
I'm talking about a semantic symbol/name in a scope, not what's emitted in the binary. You cannot call something else in that file
concatenate
for example, even if you might need itGot it! Thank you a lot for your kind replies