|
![](/i/fill.gif) |
Warp wrote:
> Many C++ style guides have a hard rule of "no 'using' in header files,
> period". (Personally I expand it to "no 'using' *anywhere*, period",
> although there are situations where it might be acceptable.)
I heartily agree. ;-)
Altho a "using namespace" inside an individual function might make sense, or
inside an individual class declaration, especially if it's a custom
namespace with hard-to-confuse names anyway.
>> I always found the "::" part visually disruptive.
>
> I don't know about that. To me it actually makes it clearer than if there
> was only alphanumerical characters, or even underscores, in the names.
I just think "::" is too much punctuation, compared to "." or "/" or even
just one ":" or something. It's a minor thing, really.
> The cretor(s) of C++ decided on "::" (an idea which might have been copied
> from some other language, although I don't know which one). I'd say it's as
> good of a choice as anything else. Or do you have any better suggestion?
Everyone else (C#, Java, Python, etc) seem to get along just fine using "."
for namespaces, member invocations, etc. I think C++ went with "::" to stay
syntactically compatible with C.
> Once you have written a lot of code with fully qualified names, it becomes
> natural and fluent (to both write and read).
Sure. As I say, I personally find it a bit ugly, but with syntax coloring
it's less so.
>> It's a shame languages are
>> still written to use only ASCII. I guess with syntax coloring, it's a lot
>> easier to skip over the syntactic noise as well.
>
> Actually the C++ standard allows identifier names to be written using
> UTF-8 (but I don't know how many compilers actually support this). Of
> course that doesn't change any of the operators and delimiters, though.
I didn't mean "ASCII" as much as I meant "plain unformatted text". I.e., to
build into the language something more along the lines of what syntax
coloring gives you in IDEs.
> a natural (and irrational) aversion towards such prefixes for years, but
> once I started using them, they are actually wonderful.
I find it's rather a hinderance if you haven't really nailed down how you
want the code to work before writing it, unless you have an IDE that lets
you change it. I'd also rather have syntax coloring doing this sort of
thing, so my member variables are orange, my statics are blueish, etc.
--
Darren New, San Diego CA, USA (PST)
Ada - the programming language trying to avoid
you literally shooting yourself in the foot.
Post a reply to this message
|
![](/i/fill.gif) |