Re:A nice, little known C feature: Static array indices in p...
by evincarofautumn on Monday February 18, 2013 @03:43PM
(#5240513)
Or you can add context-sensitive keywords, which are keywords only where it’s syntactically valid and identifiers elsewhere. Those two contexts are almost always mutually exclusive, and it’s obvious which one you’re in. ActionScript 3, though absolutely not a good example of language design in general, has a good example of this. You can say:
But you can also say:
[ Parent
| on HN ]
Re:A nice, little known C feature: Static array indices in p...
by bunderbunder on Monday February 18, 2013 @05:32PM
(#5241205)
C# is up to about 25 of them, and it works well as long as you can resist the temptation to do silly things like
var var = 1;
var select = var.ToString();
var from = from c in @select select c.GetHashCode();
(The @ thing, which tells the compiler, "This is an identifier and not a keyword", can help quite a bit in a pinch.)
Re:A nice, little known C feature: Static array indices in p...
by ggchappell on Monday February 18, 2013 @04:32PM
(#5240819)
C++11 also has them: override and final.
So:
class Foo
{
virtual void bar() final;
};
But: int final = 3;
So, for example, this is legal: class Foo
{
virtual void final() final;
};