language-design Questions

4

Solved

Is there any good reason for operator = not being a sequence point? Both in C and C++. I have trouble thinking about an counter-example.

6

Solved

Declaring a class within a class is valid. (Nested classes) Declaring a namespace within a class is invalid. The question is: is there any good reason (other than c++ grammar/syntax problems) to ...
Codeine asked 21/11, 2012 at 0:10

4

I'm new to functional programming and I've just came across the pattern of dividing lists in head and tail. I have a background in Javascript and Python, languages where this division is not adopte...

3

Solved

The code: function updateDashboardData() { $.getJSON("includes/system/ajaxDataInterface.php", {recordcount:1}, function(data) { $('.stationContainer').each(function(data) { var bsID = $(this).a...
Trow asked 28/5, 2009 at 18:46

2

Solved

The YAML spec clearly states: Mappings use a colon and space (“: ”) to mark each key: value pair. So this is legal: foo: bar But this, Ain't: foo:bar I see many people online that are r...
Oscine asked 8/2, 2017 at 21:44

2

Solved

So I was watching this video on the Go language - https://www.youtube.com/watch?v=p9VUCp98ay4 , and at around 6:50 a guy asks a question about why they implemented if's as statements and not expres...
Joselow asked 27/6, 2017 at 1:17

6

Solved

I understand what variable length arrays are and how they are implemented. This question is about why they exist. We know that VLAs are only allowed within function blocks (or prototypes) and that...
Hagridden asked 20/3, 2014 at 10:40

13

I'm pretty sure I already saw this question somewhere (comp.lang.c++? Google doesn't seem to find it there either), but a quick search here doesn't seem to find it, so here it is: Why does std::map...
Pharmacognosy asked 28/10, 2009 at 19:30

8

Solved

One of the basic data types in R is factors. In my experience factors are basically a pain and I never use them. I always convert to characters. I feel oddly like I'm missing something. Are there...
Charmeuse asked 10/8, 2010 at 1:6

10

Solved

I've been working with providers a fair bit lately, and I came across an interesting situation where I wanted to have an abstract class that had an abstract static method. I read a few posts on the...
Accordingly asked 6/8, 2008 at 11:4

5

Solved

If I were looking to create my own language are there any tools that would help me along? I have heard of yacc but I'm wondering how I would implement features that I want in the language.
Optical asked 13/12, 2008 at 19:33

1

Solved

This is a follow up question I asked incidentally at the end of Why does the TypeScript compiler compile its optional chaining and null-coalescing operators with two checks? As resident TypeScript ...
Maccabean asked 5/11, 2021 at 16:6

1

Solved

Why does the TypeScript compiler compile its optional chaining and null-coalescing operators, ?. and ??, to // x?.y x === null || x === void 0 ? void 0 : x.y; // x ?? y x !== null && x !==...
Gintz asked 4/11, 2021 at 16:59

6

Solved

Why std::optional (std::experimental::optional in libc++ at the moment) does not have specialization for reference types (compared with boost::optional)? I think it would be very useful option. Is ...
Odontoblast asked 11/11, 2014 at 5:18

6

Solved

Maybe this question has been answered before, but the word if occurs so often it's hard to find it. The example doesn't make sense (the expression is always true), but it illustrates my question. ...
Gilbertina asked 2/7, 2011 at 19:52

10

Solved

I haven't used C very much in the last few years. When I read this question today I came across some C syntax which I wasn't familiar with. Apparently in C99 the following syntax is valid: void f...

12

Solved

Having a friendly debate with a co-worker about this. We have some thoughts about this, but wondering what the SO crowd thinks about this?
Julide asked 14/1, 2009 at 16:35

1

Solved

Haskell lists are constructed by a sequence of calls to cons, after desugaring syntax: Prelude> (:) 1 $ (:) 2 $ (:) 3 [] [1,2,3] Are lists lazy due to them being such a sequence of function cal...

2

Solved

I recently had to help troubleshoot an issue someone had with returning from a generic method, and while there were multiple problems to be solved, I understood and could explain all of them - exce...
Floccose asked 27/8, 2021 at 21:6

5

Solved

#include <compare> struct A { int n; auto operator<=>(A const& other) const { if (n < other.n) { return std::strong_ordering::less; } else if (n > other.n) { retur...

7

Solved

Every time somebody asks a question about delete[] on here, there is always a pretty general "that's how C++ does it, use delete[]" kind of response. Coming from a vanilla C background wh...
Collbaith asked 17/5, 2021 at 23:34

6

Solved

Is there a reason I am missing that a block within a case statement isn't considered a block level declaration space? I keep getting an error (variable has already been declared) when I try case...
Vallation asked 2/7, 2009 at 14:10

6

Solved

According to the Java Language Sepecification, 3rd edition: It is a compile-time error if a generic class is a direct or indirect subclass of Throwable. I wish to understand why this decision ...
Willem asked 1/2, 2009 at 18:7

2

Solved

Let's take implementation of the std::unique_lock from the Standard Library: struct defer_lock_t { explicit defer_lock_t() = default; }; struct try_to_lock_t { explicit try_to_lock_t() = default; ...
Archivist asked 16/8, 2018 at 16:8

2

Solved

In Java, final means a variable can only be assigned to once, but that assignment can happen anywhere in the program. In C#, readonly means a field can only be assigned in a constructor, which, IMO...
Colloquium asked 22/2, 2013 at 14:57

© 2022 - 2024 — McMap. All rights reserved.