language-design Questions

2

Solved

The functions from P0553R4: Bit operations are constrained to only work on unsigned integers. The proposal does not give a reason for this constraint. I can see that this makes sense if the bit rep...
Ciliary asked 5/6, 2023 at 13:56

2

Solved

From the well-known C++ coroutine library (search "Don't allow any use of co_await inside the generator coroutine." in the source file generator.hpp), and from my own experiments, I know ...
Crossways asked 30/12, 2021 at 18:53

7

Solved

As I understand it, C#'s foreach iteration variable is immutable. Which means I can't modify the iterator like this: foreach (Position Location in Map) { // We want to fudge the position to hide t...
Edieedification asked 22/4, 2009 at 9:48

34

Solved

Anyone tinkering with Python long enough has been bitten (or torn to pieces) by the following issue: def foo(a=[]): a.append(5) return a Python novices would expect this function called with no ...

5

Solved

I learned today that there are digraphs in C99 and C++. The following is a valid program: %:include <stdio.h> %:ifndef BUFSIZE %:define BUFSIZE 512 %:endif void copy(char d<::>, cons...
Arathorn asked 11/1, 2009 at 6:7

1

Solved

The keyword constexpr enforced pretty tight restrictions on functions on its introduction into the C++11 standard. These restrictions were loosened with C++14 and C++20 (most noteworthy): C++14 al...
Greatnephew asked 23/1, 2023 at 15:37

17

Solved

Why doesn't Java include support for unsigned integers? It seems to me to be an odd omission, given that they allow one to write code that is less likely to produce overflows on unexpectedly larg...
Lati asked 10/1, 2009 at 1:35

4

Solved

Math: If you have an equation like this: x = 3 mod 7 x could be ... -4, 3, 10, 17, ..., or more generally: x = 3 + k * 7 where k can be any integer. I don't know of a modulo operation is def...
Mcgary asked 24/7, 2012 at 11:54

2

Solved

Reading the basic introduction: If you try to use a subscript that is not in the array, you will get an error: array access is bounds-checked at run-time. Why does Rust check array bounds at r...
Nylanylghau asked 8/2, 2015 at 0:56

15

Solved

Looking to get the fundamentals on where the term "void" comes from, and why it is called void. The intention of the question is to assist someone who has no C experience, and is suddenly looking a...
Unkempt asked 25/6, 2009 at 10:4

6

Solved

Why can I use super only with wildcards and not with type parameters? For example, in the Collection interface, why is the toArray method not written like this interface Collection<T>{ &lt...
Pyxis asked 10/5, 2010 at 4:48

0

This is about language design of JavaScript: why does JavaScript have both .prototype and internal .[[prototype]]? Why it doesn't always use read-write property .prototype instead of having hidden ...

6

Solved

a statement that checks if something is true and if not prints a given error message and exits
Palish asked 10/2, 2010 at 0:34

9

Solved

I was working on serializing values when found out about this one. Ruby has a TrueClass class, and a FalseClass class, but it has no Boolean class. I'd like to know why is this. I see some advanta...
Obstinate asked 7/7, 2010 at 8:15

8

Solved

I'm designing a language, and I'm wondering if it's reasonable to make reference types non-nullable by default, and use "?" for nullable value and reference types. Are there any problems with this?...
Coppins asked 28/3, 2009 at 19:9

7

Solved

I just came across an interesting situation in JavaScript. I have a class with a method that defines several objects using object-literal notation. Inside those objects, the this pointer is being u...
Bernadette asked 25/9, 2008 at 15:25

21

Solved

Java doesn't allow multiple inheritance, but it allows implementing multiple interfaces. Why?
Verbalism asked 25/3, 2010 at 12:40

3

I recently learned about the possibility to have custom awaitable types and as this question and Stephen Toub states, there are several requirements to be an awaitable type. So if a type T wants t...
Trinary asked 7/4, 2020 at 8:3

3

Solved

With this piece of code: trait B[T] trait C[T] class A[T] extends B[A[C[T]]] I get the following error: error: class graph is not finitary because type parameter T is expansively recursive cla...

5

I never need the ending newline I get from gets. Half of the time I forget to chomp it and it is a pain in the.... Why is it there?
Comely asked 21/6, 2011 at 21:58

4

Solved

What does TypeState refer to in respect to language design? I saw it mentioned in some discussions regarding a new language by mozilla called Rust.
Disembroil asked 9/7, 2010 at 5:22

2

This Dart official video states that Dart's so-called "sound null safety" is better than Kotlin's null safety design, because it can optimise the code based on whether a variable is decla...

11

Solved

Java is pass-by-value. How could you modify the language to introduce passing by reference (or some equivalent behavior)? Take for example something like public static void main(String[] args) { ...
Divinadivination asked 22/1, 2014 at 4:42

0

In this code, template<class T, class U> concept always_true = true; template<class T> concept always_true_if_tagged = always_true<T, typename T::tag>; struct A { using t...
Chalcography asked 11/4, 2022 at 2:6

2

Solved

Is there any rule about which built-in and standard library classes are not subclassable ("final")? As of Python 3.3, here are a few examples: bool function operator.itemgetter slice I found a...
Tanbark asked 8/4, 2012 at 9:19

© 2022 - 2024 — McMap. All rights reserved.