5 ms·
Or you can add context-sensitive keywords, which are keywords only where it’s syntactically valid and identifiers elsewhere. Those two contexts are almost alway
by evincarofautumn 14y ago
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:
public function get foo():int { return 5; }
But you can also say:
var get:int = foo;
- ggchappell 14y agoC++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; };
- bunderbunder 14y agoC# 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.)