Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: The reuse o...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 12 of 15 Topic 9542 of 9807
Post > Topic >>

Re: The reuse of keywords in the C++ standard

by Andre Kaufmann <akfmnews@[EMAIL PROTECTED] > Apr 25, 2008 at 04:16 PM

Brendan wrote:

> [...]
> Adding a new keyword to the langauge means that you are almost
> guaranteed to break someone's code. Take a look at this discussion
> about var in C#:
> http://www.strangelights.com/blog/archive/2005/10/10/1264.aspx

The de-facto standard naming convention of C# forbids to start a class
name with a lower case char. Since all keywords start with a lower case
char, it's rather unlikely that code is broken if a new context
sensitive keyword is introduced in C#. Of course nobody is forced to use
this naming convention (besides that some QC tools warn if this
convention isn't used), but then the developer has to take the risk of
collisions in future C# versions.

> [...]
> The way compilers work, true keywords are detected at lexical analysis

Typically C++ compilers. But there are other compilers, like C# and some
C++ compilers too, which IMHO simply can't detect all keywords at
lexical analysis stage, because they sup****t (proprietary) context
sensitive keywords.

> [...]
> 
> A lot of the way languages change has to do with the inflexibility of
> lexers and parsers to tell that this syntax means this in a certain
> context, but not in another context.

Well, there are good reasons that keywords must be able to be detected
by the lexer, so that simple tools e.g. colorizing the keywords can be
implemented quite easy and to significantly reduce the complexity of the
parser / semantic stage.

But anyways IMHO it's not always the best solution, regarding code
efficiency and complexity, to prefer new library code over new keywords.
Regarding downwards compatibility and for compiler implementors it's
surely the better solution.

Andre

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 15 Posts in Topic:
The reuse of keywords in the C++ standard
"Moschops" <  2008-04-24 15:14:37 
Re: The reuse of keywords in the C++ standard
red floyd <no.spam@[EM  2008-04-25 03:44:16 
Re: The reuse of keywords in the C++ standard
"Bob" <nospa  2008-04-25 03:47:59 
Re: The reuse of keywords in the C++ standard
Peter Jones <dev-null@  2008-04-25 04:13:19 
Re: The reuse of keywords in the C++ standard
"Ivan Vecerina"  2008-04-25 04:13:19 
Re: The reuse of keywords in the C++ standard
Marco Manfredini <ok_n  2008-04-25 10:14:56 
Re: The reuse of keywords in the C++ standard
Brendan <catphive@[EMA  2008-04-25 10:15:41 
Re: The reuse of keywords in the C++ standard
Alberto Ganesh Barbati &l  2008-04-25 10:49:46 
Re: The reuse of keywords in the C++ standard
"Moschops" <  2008-04-25 10:47:58 
Re: The reuse of keywords in the C++ standard
Pete Becker <pete@[EMA  2008-04-25 11:13:19 
Re: The reuse of keywords in the C++ standard
Ron Natalie <ron@[EMAI  2008-04-25 15:39:59 
Re: The reuse of keywords in the C++ standard
Andre Kaufmann <akfmne  2008-04-25 16:16:26 
Re: The reuse of keywords in the C++ standard
nickf3 <nickf3@[EMAIL   2008-04-25 16:13:19 
Re: The reuse of keywords in the C++ standard
catphive <catphive@[EM  2008-04-26 03:33:13 
Re: The reuse of keywords in the C++ standard
marlow.andrew@[EMAIL PROT  2008-04-26 08:41:52 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 19 19:47:28 CDT 2008.