This style of writing code is similar to using classes.
(except the fact that when two units declare an object with same name and you don’t precede it with the unit name, FPC doesn’t warns and picks one resulting in some funny debug sessions).I think you hit the nail on the head about using the unit name. As you mentioned, if two units declare a function/procedure with the same name, that can create some difficult to find bugs.
What do you think about this kind of API?
If I'm not mistaken the pascal compiler takes the first unit it comes across that holds the referred procedure. If the programmer refers to the same procedure from another unit, the unit must be used as prefix. In small projects this may seem trivial, but even then conflicts with libraries can result in unexpected compiler complaints or even unexpected outcomes.Yep, I know. That's just why I'm asking for opinion. Also I think people isn't aware of modern Pascal's moduleness. I always find it awesome and underrated, and I don't understand why to add namespaces: units are namespaces by their own!
Wouldn't using the unit name create a hindrance with Codetools ? .. it seems like it would get in the way of codetools being really helpful since it will display everything that is visible in the unit every time the unit name is typed (i.e, too many choices, loss of practicality.)I mostly use Vim so... ::)
[...] I don't understand why to add namespaces: units are namespaces by their own!