Questions tagged [language-specifications]

126 questions
9
votes
3 answers

runtime type vs compile-time type method invocation

The C# 4.0 specs read: When a virtual method is invoked, the runtime type of the instance for which that invocation takes place determines the actual method implementation to invoke. In a nonvirtual method invocation, the compile-time type…
P.Brian.Mackey
  • 43,228
  • 68
  • 238
  • 348
8
votes
2 answers

Is the lambda->expression tree transformation process specified anywhere?

There are two important steps to compiling a LINQ query in C#. The first is transforming LINQ query syntax into a chain of method calls, as described in section 7.16 of the C# language specification. This transformation process is specified in…
Mason Wheeler
  • 82,511
  • 50
  • 270
  • 477
7
votes
7 answers

Questions about Structs

MSDN says that a class that would be 16 bytes or less would be better handled as a struct [citation]. Why is that? Does that mean that if a struct is over 16 bytes it's less efficient than a class or is it the same? How do you determine if your…
Malfist
  • 31,179
  • 61
  • 182
  • 269
7
votes
3 answers

Why is this C++ explicit template specialization code illegal?

(Note: I know how it is illegal, I'm looking for the reason that the language make it so.) template void Foo(); // Note: no generic version, here or anywhere. int main(){ Foo(); return 0; } template<> void…
BCS
  • 75,627
  • 68
  • 187
  • 294
7
votes
1 answer

What is a "Maximal Sub-expression" in Scala 2.8 specification §6.26.5 Eta Expansion?

In Scala 2.8 language specification, §6.26.5 Eta Expansion, it states that we need a maximal sub-expression, however, no definition of this can be found. Can someone clarify this?
Felix
  • 8,385
  • 10
  • 40
  • 59
6
votes
0 answers

Can't add a new keyword to Python

I tried to add a new keyword (a new flow statement) to Python, by following this blog post and this PEP. I'm pretty sure I've added what I needed to add to the right places, according to the PEP that I've mentioned. These are the files that I've…
6
votes
1 answer

Why Class.forName("BumpTest"), not BumpTest.class?

In JLS Sec 8.4.3.6, synchronized methods, it says: class BumpTest { // ... static synchronized void classBump() { classCount++; } } has exactly the same effect as: class BumpTest { // ... static void classBump() { …
Andy Turner
  • 137,514
  • 11
  • 162
  • 243
6
votes
1 answer

Java 8 Type Inference - How reduction is done for generic constructors?

I was reading the java 8 language specification type inference. It says that List ls = new ArrayList<>() would be first reduced ArrayList<α> -> List and then to α <= String and at the end to α = String I'm having a hard time…
psaw.mora
  • 868
  • 1
  • 7
  • 18
6
votes
2 answers

Is the F# language reference documentation available in an offline format (PDF, CHM)?

I've found several posts on hubFS of people asking if there is, or will be, offline documentation for F#. These posts haven't been answered. So I want to give it a shot and ask the same question here on SO. Where I've looked for offline…
stakx - no longer contributing
  • 83,039
  • 20
  • 168
  • 268
6
votes
3 answers

C# 'dynamic' keyword... is it really a RESERVED keyword or just a identifier that means something special when used as type?

I have a C# 4.0 parser. It accepts 'dynamic' as a keyword as a type. My parser trips over statements found in working C# 3.0 programs of the form of: dynamic = ; So, it dynamic really a keyword? Or can it still be used as an arbitrary…
Ira Baxter
  • 93,541
  • 22
  • 172
  • 341
6
votes
2 answers

Syntax (probably BNF) spec of VBA ?

I have to maintain a portion of Access 2003 VBA code, which is not my primary programming language, and while I'm pretty solid on doing regular stuff, I would still like to have a pure spec of the language syntax.. It just saves a lot of time…
Jörg Haubrichs
  • 2,215
  • 3
  • 24
  • 26
5
votes
2 answers

What does "execution trace" mean in Java Memory Model

The part of the language specification dedicated to the Java Memory Model (JMM) (link) mentions "execution trace" a lot. For example right from the start: A memory model describes, given a program and an execution trace of that program, whether the…
sanyok
  • 51
  • 2
5
votes
2 answers

Assignability question in golang specification

While reading go specification "Assignability" section, I tried to execute a couple of examples to get a better understanding of the topic, and now I can't get what am I doing wrong in my code. According to the specification, One of the cases when a…
Nick B
  • 141
  • 1
  • 7
5
votes
1 answer

Why doesn't an array access expression of a null array reference throw a NullPointerException?

Consider the following code: int[] r = null; r[0] = 1 % 0; I would have expected this to throw a NullPointerException: according to JLS Sec 15.7.1: The left-hand operand of a binary operator appears to be fully evaluated before any part of the…
Andy Turner
  • 137,514
  • 11
  • 162
  • 243
5
votes
1 answer

Binary compatibility of changing a class with static methods to interface in Java

I've faced the following weird case of an incompleteness of the Java/JVM specification. Suppose we have the classes (we will use Java 1.8 and HotSpot): public class Class { public static void foo() { System.out.println("hi"); } } public…
1 2
3
8 9