Replies: 2 comments 1 reply
-
@aganm Actually this is a topic that has been disussed/commented several times in raylib Discord forums. Avoiding prefixes was a personal decision; raylib was highly inspired by WinBGI and XNA and I tried to follow similar namings, it was simpler and clearer for my students. Afaik there was no other game library taking that approach. I explored adding prefixes and following other naming conventions in others libraries I created. Actually, At this point adding prefixes to raylib would require breaking compatibility with 8 years of library existence and many codebases. I'm afraid I have no plans for that. |
Beta Was this translation helpful? Give feedback.
-
@aganm We're talking about a notional namespace and not a technological one. So it is a convention, like "I" on the beginning of Interface names. (Bites his tongue about Hungarian notation and similar efforts.) I would think that VS Code might be helpful, although it needs to have the raylib headers set in an environment variable or in a workspace setting before Intellisense can create completions and also offer choices. Likewise in recent Visual Studio releases, for that matter. At the moment, I get squiggles on I think it is useful to print out the "cheat sheet" too. I suppose there needs to be a v4 of that and life is going to be messy for a while as breaking changes pile up and users stay on v3.7 for stability until maybe v4.1 :). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
One thing that bugs me a bit about raylib's API is that it doesn't use namespaces. By namespace I mean a prefix in front of each function. For example, SDL uses the
SDL_
prefix:Opengl uses
gl
prefixThe issue that it causes me is that have I have no way to get a list of all the raylib functions from the auto completion feature of my editor. For example:
None of these share a common namespace so I cannot make use of the autocompletion to 'discover' the functions, I have to know in advance what I'm gonna type.
Having a
Ray_
namespace could be an obvious choice. For example:Or Opengl style with a
rl
namespaceBut, since raylib's API is clearly separated into different modules, each module could have its own namespace. All core functions could start with
R_
for raylib core, all texture functions could start withT_
, for texture, all text functions could start with 'F_' for font, etc. For example:I see two upsides to having this. It reduces if not removes the risk of name collision with system libraries. And it makes autocompletion useful again because I can just type
R_
and get a list of all the raylib core functions.What do you think? Also I'd be interested to hear about why raylib was designed without a namespace, is there any advantage to it not having a namespace?
Beta Was this translation helpful? Give feedback.
All reactions