In C#, a superclass's static members are "inherited" into the subclasses scope. For instance:
class A { public static int M() { return 1; } }
class B : A {}
class C : A { public new static int M() { return 2; } }
[...]
A.M(); //returns 1
B.M(); //returns 1 - this is equivalent to A.M()
C.M(); //returns 2 - this is not equivalent to A.M...
What kind of advantages are there to changing 'cond' to be a special form instead of syntactic sugar?
...
If established name doesn't exist, what name you can suggest?
...
This is more of a language design rather than a programming question.
The following is an excerpt from JLS 15.19 Shift Operators:
If the promoted type of the left-hand operand is int, only the five lowest-order bits of the right-hand operand are used as the shift distance.
If the promoted type of the left-hand operand is long, ...
Many programming languages allow trailing commas in their grammar following the last item in a list. Supposedly this was done to simplify automatic code generation, which is understandable.
As an example, the following is a perfectly legal array initialization in Java (JLS 10.6 Array Initializers):
int[] a = { 1, 2, 3, };
I'm curious...
Possible Duplicate:
Difference between pointer variable and reference variable in C++
I am reading about the book "Inside the C++ Object Model" by Stanley Lippman. What puzzles me is the difference between a "reference" of an object and a "pointer" to an object. I know that a reference must be initialized when declared, while ...
In language design circles there used to be a long-running debate over whether languages should use structural equivalence or name equivalence. Languages like ALGOL or ML or Modula-3 used structural equivalence while ... well, pretty much most programming languages employ named equivalence (including Modula-2).
What are the typical arg...
Hello, I long for those sweet optional arguments from the days when I programmed in C++ more. I know they don't exist in C#, but my question is Why.
I think method overloading is a poor substitute which makes things messy very quickly.
void foo(int x,int y,int z=0){
//do stuff...
}
//is so much more clean than
void foo(int x,int ...
I've been working on the specifikation / kitchensink for a meta language that can compile down to PHP for some time now. Now I want to begin building the thing. Before I have implemented tiny DSL's using PHP_Lexergenerator and PHP_Parsergenerator and they have worked very well but I have never build anything this scale before. I would ap...
In Javascript, one of the reliable ways to convert a string to a number is the Number constructor:
var x = Number('09'); // 9, because it defaults to decimal
Inspired by this question, I started wondering what is the difference between the above and:
var x =new Number('09');
Number certainly looks better, but it seems like a sligh...
I'm designing a syntax for templates/generics. The C++ family languages use angle brackets for this, but I'm looking at using a separator character instead. For example, where in Java you might write:
Map<String, Foo> foos = new HashMap<String, Foo>();
I'm aiming for:
.foos = hmap*string*foo
I'm trying to decide what the separator ...
Most programming languages use parentheses for grouping subexpressions.
In Aklo, I'm using square brackets for grouping subexpressions, on the grounds that the precious unshifted brackets should be used for the most common case.
But that's on a US keyboard. Are there any keyboard layouts on which it's actually easier to type parenthese...
Namespaces were once a consideration for ECMAScript (the old ECMAScript 4) but were taken out. As Brendan Eich says in this message:
One of the use-cases for namespaces in
ES4 was early binding (use namespace
intrinsic), both for performance and
for programmer comprehension -- no
chance of runtime name binding
disagreei...
Hi,
I would like to start contributing to Cappuccino -- mainly though, Objective-J. I have a good understanding of JavaScript, but not of language design/implementation. Is there a good book that covers this topic(s)?
Thanks.
...
I'm creating a game in XNA and was thinking of creating my own scripting language (extremely simple mind you). I know there's better ways to go about this (and that I'm reinventing the wheel), but I want the learning experience more than to be productive and fast.
When confronted with code at run time, from what I understand, the usual ...
I realise you can just #define some integers, but why didn't C have a dedicated boolean data type before C99?
It's such a common occurence in programming and logic, I don't understand the absense of an explicit type and notation.
...
Why was java defined such that methods may take as input multiple parameters,
but may only return a single object (or void)?
Did it make the language somehow easier to implement or use?
...
hi, do you know if are there pointers in haskell?
-If yes, how do you use them? Are there any problems with them? And why aren't they popular?
-If no, is there any reason for it?
Please help us!! :)
Thank you so much!!
...
For my curiosity sake I'm looking for a dynamic object oriented language that allows you to change true to false and vice versa.
Something like this:
true = false, false = true;
This should also affect any conditional statements, therefore 42 == 42 should return False.
Basically, with this premise, nothing in the language would be sa...
This is not just an idle quip... I wonder if anybody knows if there's an actual design reason why Scala does not support interpolation similar to Groovy and other "syntactically better Javas"?
e.g.
var str1 = "World";
var str2 = "Hello, ${str1}";
...