Questions tagged [language-specifications]

126 questions
0
votes
0 answers

JavaScript Spec - Relevant vs Surrounding Agent

Reading through the JavaScript and related specifications, these two concepts appear: Relevant agent (HTML) Surrounding agent (ES) Some of the spec uses both. For example, in the steps of 4.2.2.5 Signaling slot change: Append slot to slot’s…
0
votes
2 answers

Why does a decimal number with a 0 before it produce a SyntaxError?

I was writing some Javascript when I accidentally typed 04.5 instead of 40.5. When I ran the code, it produced a SyntaxError that read Uncaught SyntaxError: Unexpected number. I tested this in Chrome, Safari, Firefox, and NodeJS, and they all…
shreyasm-dev
  • 2,711
  • 5
  • 16
  • 34
0
votes
3 answers

Why do array functions work like tagged template literals and what can I do with it?

Just recently I found this to be working: const str = "foo bar"; const arr = str.split` `; // <- no parens console.log(arr); // -> ["foo", "bar"] It seems like the split prototype is a tagged template literal. I also saw this working with other…
0
votes
1 answer

Inheritance of non-private fields if "not hidden by a declaration in the class"

This phrase form the Java 11 Language Specification (8.3 Field Declarations) is not clear for me A class inherits from its direct superclass and direct superinterfaces all the nonprivate fields of the superclass and superinterfaces that are…
Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335
0
votes
0 answers

Does the line-feed style of a C# here-document match Environment.Newline?

I have some unit-tests that appear to be failing because they depend on the assumption that the line-break inside a locally-compiled here-document string should match Environment.NewLine. I.e var testString=@"a multiline string"; //this…
NeilMacMullen
  • 3,339
  • 2
  • 20
  • 22
0
votes
0 answers

Why JSON specification still isn't fixed to force key-value pairs in objects to be considered ordered?

Reasons to do so seem to be very strong: The requirement to keep JSON object fields order in many cases is very common. Just search the internet. Even current JS engines now guarantee the order, probably after realization it is useful enough. Such…
0
votes
0 answers

Confusion about Java 10 grammar specification (FieldAccess seems wrong)

I am working on some syntax tree synchronising tools and try to write a parser for a small subset of Java; I am confused about the Java 10 grammar specification and consider that the definition of FieldAccess is wrong. In my opinion, the grammar of…
Zirun
  • 21
  • 4
0
votes
1 answer

Isn't "conditional operator" identical to the "ternary operator"?

Regarding C#, To my understanding the question below is wrong. meaning that a "ternary operator" and a "conditional operator" . Am I Correct? Question# 6: 10 > 9 ? “10 is greater than 9” : “9 is greater than 10” is an example of _______ Ternary…
AK_
  • 7,981
  • 7
  • 46
  • 78
0
votes
0 answers

If single-threaded and non-blocking are defining features of JavaScript, why are these terms absent from the specification?

JavaScript is turning out to be a complex ecosystem. Recently I've been reading more from the official language specification and learning a little bit more about browser implementations. Can someone help me understand where non-blocking and…
0
votes
0 answers

What does the module keyword mean in C# and why it is not in keyword list?

I found strange System.AttributeTargets value - AttributeTargets.Module. I searched it's usages and found this C# code: [module: ContractNamespace("http://tempuri.org")] It is an attribute on a something called "module". What does this module mean…
astef
  • 8,575
  • 4
  • 56
  • 95
0
votes
3 answers

Using strings when specifying a key in an object's key-value pair

When specifying a key in an object's key-value pair (using the notation below) the interpreter (apparently) allows the use of strings: var x = { 'color': '#fff' }; However specifying a key dinamically using a function (that returns a string) is not…
Paolo
  • 15,233
  • 27
  • 70
  • 91
0
votes
1 answer

Is System.Array.Clone() guaranteed to clone value types?

int[] array1 = new[] { 1, 2, 3 }; int[] array2 = (int[])array1.Clone(); array2[0] = 9; Debug.Assert(array1[0] != array2[0]); This works fine. Clone() does a shallow copy, but the array types are value types, so they get cloned too. My question is…
GazTheDestroyer
  • 20,722
  • 9
  • 70
  • 103
0
votes
1 answer

Static extension methods and Project Roslyn

It has been noted here (and quite rightly so) that extension methods in .NET are just syntactic sugar for static method calls on instance variables. However in relation to this question, I am wondering why extension methods for static access were…
Matthew Layton
  • 39,871
  • 52
  • 185
  • 313
0
votes
0 answers

Are arguments in python functions passed as tuple?

Let f be a function with 2 arguments. I do not really understand why the syntax: f(1,2,) actually works (note the ending comma)? It looks like the arguments are seen as a tuple, but in this case, if g is a function with 1 argument, why g(1) is…
Sebastien
  • 682
  • 6
  • 13
0
votes
1 answer

get index of element in array if it exists in another array/object

There are two arrays: itemKeys: [ { name: "REFOBJTYPE" }, { name: "REFOBJKEY" } ... ] itemValues: [ { value: "" }, { value: "" } ] and an object ref: { REFOBJTYPE: 1, REFOBJKEY: 2, } They are fixed and the structure…
Max
  • 1,463
  • 5
  • 19
  • 34
1 2 3
8
9