Tagged Questions
19
votes
4answers
809 views
Why do C# and Java use reference equality as the default for '=='?
I've been pondering for a while why Java and C# (and I'm sure other languages) default to reference equality for ==.
In the programming I do (which certainly is only a small subset of programming ...
9
votes
1answer
426 views
How does Go improve productivity with “implicit” interfaces, and how does that compare with C#'s notion of Extension Methods?
In the Go Language Tutorial, they explain how interfaces work:
Go does not have classes. However, you can define methods on struct types. The method receiver appears in its own argument list ...
18
votes
4answers
871 views
Why doesn't C# have local scope in case blocks?
I was writing this code:
private static Expression<Func<Binding, bool>> ToExpression(BindingCriterion criterion)
{
switch (criterion.ChangeAction)
{
case ...
9
votes
2answers
690 views
How does C++ handle multiple inheritance with a shared common ancestor?
I'm not a C++ guy, but I'm forced to think about this. Why is multiple inheritance possible in C++, but not in C#? (I know of the diamond problem, but that's not what I'm asking here). How does C++ ...
7
votes
3answers
799 views
Why do .NET modules separate module file names from namespaces?
In implementations of the Scheme programming language (R6RS standard) I can import a module as follows:
(import (abc def xyz))
The system will try to look for a file $DIR/abc/def/xyz.sls where $DIR ...
4
votes
1answer
183 views
Querying types in a co- or contravariant way
I posted a c# feature request here; however, I do not get a lot of attention there. Therefore I am asking you here, what you think of it.
The in and out keywords in generic type declarations are ...
23
votes
2answers
3k views
Why is 'void' not allowed as a generic type in C#
What were the design decisions that argued in favour of void not being constructable and not being allowed as a generic type? After all it is just a special empty struct and would have avoided the ...
8
votes
6answers
988 views
How to verify/prove orthogonality of a programming language?
I know the concept of orthogonality, but from a programming language point of view, is there a way to verify/prove it?
For instance in C#, one can use public or static for a method signature. You can ...
44
votes
12answers
4k views
Did the developers of Java consciously abandon RAII?
As a long-time C# programmer, I have recently come to learn more about the advantages of Resource Acquisition Is Initialization (RAII). In particular, I have discovered that the C# idiom:
using (var ...
5
votes
3answers
348 views
Is structural typing in a hierarchical model necessary?
This is part of a series of questions which focuses on a project called the Abstraction Project, which aims to abstract the concepts used in language design in the form of a framework.
Another ...
22
votes
8answers
14k views
Why use partial classes?
In my understanding, the partial keyword does nothing but allow a class to be split between several source files. Is there any reason to do this other than for code organization? I've seen it used for ...