Namespacing for modules (silent overwriting in cases of name collision?)
Jose E. Marchesi
jemarch@gnu.org
Thu Jan 29 19:43:59 GMT 2026
> Hello All,
>
> Been experimenting more and having waaaaaay too much fun doing so. I
> am looking forward to being able to program more and more in this
> language. (The fft library is coming along nicely!)
>
> In my recent experimentation, I created two different modules that had
> similarly named pub procedures. Everything compiled and linked just
> fine. However, of the two similarly named exported procedures, it was
> the one from the "accessed module" listed second that would be run in
> the executable code.
>
> This is understandable. However, it does raise a few questions:
>
> 1) Is there some way to obtain "namespacing" of modules that I am
> simply unaware of?
>
> 2) If this not possible presently, might this become possible at some
> point in time? (Or is this just inherently completely impossible?)
>
> 3) Should this name collision be a compilation/linker "error", or a
> "warning message"?
I am a little surprised.
If you have modules A and B and both modules publicize the same
identifier, if you do:
access A, B (...) or access A, B def ... fed
Then you should get a compile error message.
But if you do:
access A access B (...)
Then the definition in B will ghost the definition in A.
Still you should be able to get a warning in that case if you use
-Whidden-declarations=all.
Is that not the case?
>
> Regards,
> James
>
> PS Please disregard if this is bothersome question. I can respect that.
More information about the Algol68
mailing list