Tag Info

Hot answers tagged

61

From The Design and Evolution of C++ - Bjarne Stroustrup - Addison-Wesley (ISBN 0-201-54330-3) - chapter 13.2.3: The curious = 0 syntax was chosen over the obvious alternative of introducing a new keyword pure or abstract because at the time I saw no chance of getting a new keyword accepted. Had I suggested pure, Release 2.0 would have shipped without ...


49

Visual Studio doesn't know what code you intend to write so includes the most common namespaces for you by default in the "new class" template. This is done so you don't have to resolve all the references for every single line of new code you write. Once you have written your basic code if you right click and select Organize Usings > Remove and Sort it will ...


42

Ask yourself who the end user is. If it's meant to be written by someone with programming experience in C or Javscript, or IT experience in Unix, then case sensitivity is probably the right thing to do, because that's what the user expects. But for most end-users, even power-users, this will be confusing. VB/VBA/VBScript are case-insensitive, and this was a ...


16

While most likely not a very big difference and programmers would have been able to handle it just the same: "continue" makes it clear that the loop will go on processing data (stop the details, continue the loop), while "skip" could be thought of as terminating the loop totally (like break in C++). It's one of those cases where it can be difficult to find ...


16

You should decide based on the user experience you wish to present, not how easy or hard it is to implement. If it will make it easier for your users to have case insensitivity then that's what you should implement. As a case in point SQL is case insensitive. This makes it very easy to use in an interactive setting. Another way to look at this is will ...


16

You can use it to imitate return type covariance. Eric Lippert's Explanation . Eric provides this example code: abstract class Enclosure { protected abstract Animal GetContents(); public Animal Contents() { return this.GetContents(); } } class Aquarium : Enclosure { public new Fish Contents() { ... } protected override Animal GetContents() ...


15

I imagine that backwards compatibility with perfectly standard code is a more important reason. If you add a keyword that might have been used as a legitimate identifier in previous code, you create a ton of pain, of possible subtle errors, especially in C, a language with somehow complicated parsing rules. If these identifiers were used as a public ...


13

There is a connection, however it is a little loose. In C# the keywords ´in´ and ´out´ as their name suggest stand for input and output. This is very clear in the case of output parameters, but less clean what it have to do with template parameters. Lets take a look at the Liskov substitution principle: ... Liskov's principle imposes some standard ...


12

I guess it might have to do with history of programming languages. To ask why it is continue in Java is to ask why it is continue in C++, which is to ask why it is continue in C, Algol etc. To my knowledge, Fortran was the first to have a CONTINUE statement, actually a no op. It was just there to make it possible to place a (numeric) label used in goto or ...


11

Programming languages should be case-sensitive, period. People can adjust to this very easily: they simply have to remember to work mostly in lower case, and to watch out for mixed-case or all-caps identifiers in existing API's. It once seemed obvious to make languages case-insensitive. This is because lower case was not available on all computing systems ...


11

An interface is a contract. It does not implement anything (properly-used default methods are a small exception). What would it mean for one interface to "implement" another, anyway? It would need to have method bodies for some or all methods on the superinterface, making it a class.


9

@Gábor has already explained the connection (contravariance for all that goes "in", covariance for all that goes "out"), but why re-use keywords at all? Well, keywords are very expensive. You cannot use them as identifiers in your programs. But there is only so many words in the English language. So, sometimes you run into conflicts, and you have to ...


7

The question is not how many meanings it has, but whether or not it's reserved. When Microsoft adds new features to C#, it sometimes need to add new keywords. This can compromise backward compatibility, since it invalidates old code that declares identifiers with the same name. To prevent this, Microsoft makes these new keywords contextual - they only serve ...


6

The real determining factor is how often you're going to want to have multiple things with the same name. Case insensitivity works in SQL because it's not often you want a column named SELECT. It would be annoying in Java because every other line looks like Object object = new Object(), where you want the same name to refer to a class, an instance, and a ...


6

Names beginning with an underscore and a capital letter (and anything with double underscore) were reserved for compiler/standard library implementation in previous standards. From Reserved Identifiers of C89 and C99: Also reserved for the implementor are all external identifiers beginning with an underscore, and all other identifiers beginning with ...


5

Assumed your script language will be case sensitive - are you going to create a compiler or syntax checker that will tell the user if he makes a typo by using the wrong case in a variable name or a keyword? If not, that would be a very strong argument for making the language case insensitive.


5

The term late or dynamic binding describes how the identifier is resolved into the actual implementation of the method, it doesn't describe how the virtual method is used. If any of those would have been used to describe the method, something like late-bound or dynamically-bound would have been used, which is not only long-winded, but also a bit too close to ...


5

Yes you can remove any using directive that is not being used.These directives are automatically added by visual studio since they are the most commonly used ones and if for instance you are not going to use linq in the interface then you can remove the directive System.Linq; The same holds true for other directives as well.Also it is a good practice in ...


5

Isn't it correct to say that if something is Shared then you know there will be only one instance of it throughout the whole application. However if something is Static then there could well be many live instances of class but each instance will retain it's own value after termination of the procedure it lives in? Conceptually they are different. ...


4

Can you declare variables on-the-fly ? If so i would argue against case sensitive, as tracking down a bug caused by ATypo = 42; as opposed to Atypo = 42; is needlessly asking for debugging time, when having the two statements equivalent just makes life easier.


3

The word itself was introduced with SIMULA-67. Ole-Johan Dahl's history indicates that the introduction of 'virtual' into SIMULA occurred just before May 1967, just in time to be included in the paper Class and Subclass declaration that was presented at the IFIP TC2 Conference on Simulation Programming Languages. However, there is no note to indicate why ...


3

DrRacket maintains a list of keywords that it understands for auto-indentation, which you can find in the Preferences (under Editing->Indenting). If an identifier is listed as a keyword for indentation, then DrRacket will also highlight it differently if the chosen color scheme differentiates keywords from plain identifiers. Identifiers like + are not ...


3

These default using statements are part of your default template when creating interfaces. You can always edit the template to have them removed. See this question for more details.


3

It's telling the reader that "I deliberately hid the base class' implementation of this method", as opposed to accidentally.


3

I think it is there in case you might need it to do something the language designers might not have thought of. C# was in many ways a reaction to early versions of java. And one thing java did was to very explicitly pigeonhole developers to eliminate possiblities of developers shooting themselves in the feet. C# took a slightly different approach and gave ...


2

Examples of languages like FORTRAN, BASIC, SQL are given saying that these are case insensitive. The reason why FORTRAN and SQL (and COBOL) are case insensitive is that they were originally designed for use on machines where the normal character sets had only uppercase letters. Case insensitivity in those languages (at least) is more a historical ...


2

the & in (defn full-name [& {first :first last :last}] indicates that all the remaining arguments should be gathered into a single collection. the map destructuring form following the & then takes the map created by the & apart again. (defn full-name [& {first :first last :last}]...) (full-name :first "Tom" :last "Brennan") without the ...


2

This is more of a historical curiosity, but Visual Basic for Applications, the scripting language of Office, used to use localized keywords in some early versions of Word and Excel. Luckily, that madness was over soon, and with Office 97 they switched back to a locale-independent set of keywords (which happened to be English). Here's an example quoted from ...


2

I know there are something like chinesepython which you could use Chinese to write python. Though I don't know is there a big project written by it.


1

There's also polish programming language. it's called ZDICH As you can see on screenshots, you must write every statement and expression in polish, like piszl (writel), Koniecv(End) to compile the code.



Only top voted, non community-wiki answers of a minimum length are eligible