Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: why not using a namespace  (Read 25111 times)

0 Members and 1 Guest are viewing this topic.

mweb

  • Newbie
  • *
  • Posts: 13
    • View Profile
why not using a namespace
« on: August 14, 2007, 11:14:43 pm »
Why did you choose to use prefixes in front of each class instead of using a namespace for the how SFML? I usualy prefer to use namespaces but maybe you got a good reason for it.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
why not using a namespace
« Reply #1 on: August 14, 2007, 11:34:29 pm »
Not really a good reason, it's more a personal style. Anyway, I don't think this is a problem, right ?
Laurent Gomila - SFML developer

Alp

  • Jr. Member
  • **
  • Posts: 56
    • MSN Messenger - alpmestan@hotmail.com
    • View Profile
    • http://alp.developpez.com/
    • Email
why not using a namespace
« Reply #2 on: August 14, 2007, 11:45:13 pm »
As namespaces are mainly used to avoid name conflicts, and as SFML classes are prefixed by "sf", I don't think that putting SFML in a namespace would be that useful ;)
SFML developper

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
why not using a namespace
« Reply #3 on: August 15, 2007, 12:07:08 am »
I think he suggested to use sf::Window instead of sfWindow (for example), not sf::sfWindow ;)
Laurent Gomila - SFML developer

Alp

  • Jr. Member
  • **
  • Posts: 56
    • MSN Messenger - alpmestan@hotmail.com
    • View Profile
    • http://alp.developpez.com/
    • Email
why not using a namespace
« Reply #4 on: August 15, 2007, 12:09:56 am »
Indeed. I think too.
It's not really useful for the moment :)
SFML developper

mweb

  • Newbie
  • *
  • Posts: 13
    • View Profile
why not using a namespace
« Reply #5 on: August 15, 2007, 01:42:05 am »
Ok it is not necessary but the namespace was added to the c++ that the prefixes for classes are no more necessary. But since this is your project it is your decision. And as you said it is not that important. I just wanted to ask.

Alp

  • Jr. Member
  • **
  • Posts: 56
    • MSN Messenger - alpmestan@hotmail.com
    • View Profile
    • http://alp.developpez.com/
    • Email
why not using a namespace
« Reply #6 on: August 15, 2007, 11:47:54 am »
Maybe one day it will be necessary. We'll see :)
SFML developper

mweb

  • Newbie
  • *
  • Posts: 13
    • View Profile
why not using a namespace
« Reply #7 on: August 15, 2007, 03:07:51 pm »
I don't see a reason why it should get necessary, it is just more convenient and usually it is easier to change something if it is smaller and not bigger ;-)
We will see.

Gawen

  • Newbie
  • *
  • Posts: 3
    • MSN Messenger - silvereleven@hotmail.fr
    • View Profile
why not using a namespace
« Reply #8 on: August 15, 2007, 05:54:40 pm »
I agree with mweb. Namespaces had been created especially for this kind of consideration.

Indeed do not using namespace won't kill every babies seals of the world, but why do not use something especially created for that ?

I think mweb is right, it won't be necessary : that's just C++ philosophy, a C++ concept. A way to respect the reason.

Well, ok, I know that's not really important :)

lubos

  • Newbie
  • *
  • Posts: 17
    • ICQ Messenger - 385328377
    • MSN Messenger - qwarmail@yahoo.co.uk
    • View Profile
why not using a namespace
« Reply #9 on: August 16, 2007, 09:40:53 pm »
hi, new user there im gonna give sfml a try :D
personally i like namespaces more also  :P
have a nice day

Alp

  • Jr. Member
  • **
  • Posts: 56
    • MSN Messenger - alpmestan@hotmail.com
    • View Profile
    • http://alp.developpez.com/
    • Email
why not using a namespace
« Reply #10 on: August 16, 2007, 10:08:01 pm »
I like them too.

It represents well modules and prevent name conflicts.

But putting SFML in a namespace is not urgent ;)
SFML developper

PM

  • Newbie
  • *
  • Posts: 18
    • View Profile
why not using a namespace
« Reply #11 on: August 16, 2007, 11:14:51 pm »
Quote from: "Alp"
But putting SFML in a namespace is not urgent ;)

If putting SFML in a namespace is planned - then you should do it as soon as possible. Because if you will do it later (when there's nothing else to code) - you will create a lot of problems for the users of your library (they'll have to convert their code too, you know).

So, here's the verdict - if you're going to do it, then do it *now*. Otherwise, just tell people to ST(F)U and that you will never put it in a namespace.

Personally, I like namespaces and I use them a lot in my code.

Alp

  • Jr. Member
  • **
  • Posts: 56
    • MSN Messenger - alpmestan@hotmail.com
    • View Profile
    • http://alp.developpez.com/
    • Email
why not using a namespace
« Reply #12 on: August 17, 2007, 02:15:30 am »
The Dev. Team will discuss discuss about it tomorrow.

Thanks for your suggestions ;)
SFML developper

lubos

  • Newbie
  • *
  • Posts: 17
    • ICQ Messenger - 385328377
    • MSN Messenger - qwarmail@yahoo.co.uk
    • View Profile
why not using a namespace
« Reply #13 on: August 17, 2007, 01:38:57 pm »
let us know how did you decided  8)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
why not using a namespace
« Reply #14 on: August 17, 2007, 01:53:35 pm »
I made this choice of not using namespaces when I started to write the library, for various reasons (mainly a personal style, there is no particular technical reason).

Now, I'm ok to change it, but as it's an important decision I need stronger arguments. Not only "it's C++ philosophy" or "namespaces are cute" ;)
Laurent Gomila - SFML developer