Questions tagged [language-specifications]

126 questions
19
votes
3 answers

XSD doesn't allow me to have unbounded inside all indicator

I'm trying to make unordered list of variables in var1 occurs twice and var2 occurs infinite times (Use case in my project is different). The element does not allow me to use maxOccurs. Is there any work around for what I'm trying to do?
Vignesh
  • 1,130
  • 2
  • 12
  • 19
15
votes
4 answers

How to refer to a class when both simple and fully-qualified names clash

Consider the following pathological example: class Ideone { static class ArrayList { ArrayList() { System.out.println("!!"); } } static class java { static class util { static class ArrayList { …
Andy Turner
  • 137,514
  • 11
  • 162
  • 243
14
votes
4 answers

++i operator difference in C# and C++

I have the following code written in both C++ and C# int i=0; ++i = 11; After this C# compiler brings an error The left-hand side of an assignment must be a variable, property or indexer But C++ compiler generate this code with no error and I…
shift66
  • 11,760
  • 13
  • 50
  • 83
14
votes
2 answers

Is casting from Object to boolean valid Java language?

I stumbled upon an old Java code during work that was implemented years ago by a C programmer, and we couldn't help but do start a discussion whether or not the code - even though it compiles and works - is actually valid Java code. final Object o =…
TwoThe
  • 13,879
  • 6
  • 30
  • 54
13
votes
2 answers

Why is it not allowed in Java to overload Foo(Object...) with Foo(Object[])?

I was wondering why it is not allowed in Java to overload Foo(Object[] args) with Foo(Object... args), though they are used in a different way? Foo(Object[] args){} is used like: Foo(new Object[]{new Object(), new Object()}); while the other…
Eng.Fouad
  • 115,165
  • 71
  • 313
  • 417
13
votes
4 answers

Operator '==' can't be applied to type T?

I thought this method was valid but I was wrong: static void Equals(T x, T y) { return x == y; //operator == can't be applied to type T } After reading the specifiation (§7.2.4 in v3.0 and §7.3.4 in v4.0): 7.2.4 Binary operator overload…
Cheng Chen
  • 42,509
  • 16
  • 113
  • 174
12
votes
6 answers

Has the C# spec (team? committee?) ever considered this object creation syntax?

I've never posted a question of this nature before, so if it's not proper for SO, just don't hurt my feelings too bad and I'll delete it. In the interest of keeping everything I care about as close to the left margin as possible, I keep wishing I…
Aaron Anodide
  • 16,906
  • 15
  • 62
  • 121
12
votes
1 answer

What is the purpose of external static constructors in C#?

Accordingly to the section "10.12 Static constructors" of "C# Language Specification. Version 5.0" static constructor can be marked with "extern" modifier and in this case it's said to be an external static constructor. The ordinary (non-external)…
12
votes
3 answers

Inside a while loop, is the last comma separated statement guaranteed to run last?

Consider the following (trivial) code segment: while (i++, i <= 10) { // some more code } In the general case, C++ allows comma separated statements to be evaluated in any order. In the case of a while loop, are we at least guaranteed (by the…
Felix Fung
  • 1,711
  • 19
  • 27
12
votes
1 answer

If an identity conversion exists from S to T, must it be that S and T are same type?

In 6.1.6. of the C# language specification, there is: The implicit reference conversions are: (...) From any reference-type to a reference-type T if it has an implicit identity or reference conversion to a reference-type T0 and T0 has an identity…
Petr Hudeček
  • 1,623
  • 19
  • 30
11
votes
4 answers

Question regarding implicit conversions in the C# language specification

Section 6.1 Implicit conversions defines an identity conversion thusly: An identity conversion converts from any type to the same type. This conversion exists such that an entity that already has a required type can be said to be convertible to…
Timwi
  • 65,159
  • 33
  • 165
  • 230
10
votes
1 answer

Objective-C 2.0 ABI specification

Does documentation for the Objective-C 2.0 ABI exist somewhere on the Internet? The release notes for objc4-493.9 say: Forthcoming documentation will describe the ABI for the use of compilers and developer tools only. Has it since been released?…
Aidan Steele
  • 10,999
  • 6
  • 38
  • 59
10
votes
1 answer

What is the evaluation order of tuples in Rust?

Tuple elements may have side-effects, and some of them may depend on others. Consider this program: fn main() { let mut v = vec![1, 2]; match (v.pop(), v.pop()) { (Some(z), Some(y)) => println!("y = {}, z = {}", y, z), _ =>…
10
votes
2 answers

Why is "do" allowed inside a function?

I noticed that the following code compiles and works in VS 2013: let f() = do Console.WriteLine(41) 42 But when looking at the F# 3.0 specification I can't find any mention of do being used this way. As far as I can tell, do can have the…
svick
  • 236,525
  • 50
  • 385
  • 514
9
votes
1 answer

Where is it specified whether Unicode identifiers should be allowed in a Haskell implementation?

I wanted to write some educational code in Haskell with Unicode characters (non-Latin) in the identifiers. (So that the identifiers look nice and natural for speakers of a natural language other than English which is not using the Latin characters…
1
2
3
8 9