language-design Questions

8

Solved

Closures are an incredibly useful language feature. They let us do clever things that would otherwise take a lot of code, and often enable us to write code that is more elegant and more clear. In P...
Dispersal asked 5/1, 2010 at 21:57

13

Solved

According to ISO C++, dereferencing a null pointer is undefined behaviou. My curiosity is, why? Why has the standard decided to declare it undefined behavior? What is the rationale behind this deci...
Hyperboloid asked 22/7, 2011 at 16:43

5

Solved

It looks strange especially for C++ developers. In C++ we used to mark a parameter as const in order to be sure that its state will not be changed in the method. There are also other C++ specific r...
Lurette asked 16/7, 2010 at 8:6

2

Solved

The Swift language has a fantastic enum support. Not only can one define a standard enum with cases, but cases can have optional values "associated to them." For example, taken from the Swift docs...
Twelfthtide asked 30/1, 2016 at 19:22

4

Solved

Why cannot I use local variables from main to be used in basic asm inline? It is only allowed in extended asm, but why so? (I know local variables are on the stack after return address (and therefo...
Cordiacordial asked 14/2, 2020 at 14:9

3

From a language design perspective, why aren't ruby blocks first-class? Similarly, I think blocks should actually be lambdas, thereby getting rid of the need for cumbersome syntax such as proc {.....
Arterial asked 13/7, 2011 at 21:18

4

Solved

In C++, the operator :: is used to access classes, functions and variables in a namespace or class. If the language specification used . instead of :: in those cases too like when accessing instan...
Forester asked 31/1, 2020 at 11:11

3

Solved

Why doesn't C++ have a keyword to define/declare functions? Basically all other design abstractions in the language have one (struct, class, concept, module, ...). Wouldn't it make the language ea...
Groningen asked 31/1, 2020 at 8:40

9

Solved

Why does COBOL have both SECTION and PARAGRAPH? Can anybody explain why the designers of COBOL created both SECTIONs and PARAGRAPHs? These have been around since the initial release of COBOL so I ...
Stutter asked 4/11, 2009 at 17:39

9

Solved

I just learned today that the following Java code is perfectly legal: myBlock: { /* ... code ... */ if (doneExecutingThisBlock()) break myBlock; /* ... more code ... */ } Note that myBlock...
Krantz asked 24/2, 2011 at 2:11

1

Solved

How do I define a pointer to a variable or list element in Julia? I have tried reading some resources but I am really confused about using a pointer in Julia.
Angwantibo asked 1/12, 2019 at 12:42

3

Solved

The term Von Neumann languages is applied to programming languages whose computational model is based on the Von Neumann computer architecture. Is C++ considered a Von Neumann language, or if i...

1

Solved

What can ref do that references couldn't? Could match value.try_thing() { &Some(ref e) => do_stuff(e), // ... } not be equally expressed by match value.try_thing() { &Some(e) => d...
Therefore asked 8/10, 2019 at 19:2

3

Solved

https://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique writes that std::make_unique can be implemented as template<typename T, typename... Args> std::unique_ptr<T> make_unique...
Butacaine asked 13/3, 2019 at 12:10

13

Solved

I am a big fan of letting the compiler do as much work for you as possible. When writing a simple class the compiler can give you the following for 'free': A default (empty) constructor A copy and...

8

Why do programming languages take a long to compile? Assumed c++ takes a long time because it must parse and compile a header every time it compiles a file. But I -heard- precompiled headers ...
Fetid asked 26/2, 2009 at 2:41

2

Solved

As I understand it Clojure does not expose the reader macro table or allow user defined reader macros. From http://clojure.org/reader: The read table is currently not accessible to user programs....
Kavanagh asked 8/9, 2015 at 8:39

7

Solved

I would like to create my own programming language. Maybe not exactly a programming language from scratch but maybe base it on another language. I've heard of Yacc. So, I installed Flex and Bison...

9

Solved

I had a very difficult time with understanding the root cause of a problem in an algorithm. Then, by simplifying the functions step by step I found out that evaluation of default arguments in...
Zig asked 30/10, 2009 at 17:16

9

Solved

Why does the new operator exist in modern languages such as C# and Java? Is it purely a self documenting code feature, or does it serve any actual purpose? For instance the following example: Cla...
Gingerly asked 11/1, 2009 at 20:18

2

Solved

I've read https://stackoverflow.com/a/12161946/ which somewhat addresses OCaml exceptions in the context of performance and mentions that one might use exceptions to intentionally manipulate contro...
Scotopia asked 11/7, 2019 at 4:48

9

Solved

As per the comment under this answer, references were introduced primarily to support operator overloading which quotes Bjarne Stroustrup: References were introduced primarily to support operat...
Tilley asked 30/5, 2011 at 1:47

3

What is the most practical way of overcoming needle haystack confusion in PHP? Here $needle is the first argument bool in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] ) Her...
Drucie asked 29/6, 2012 at 11:1

6

Binding times can be classified between two types: static and dynamic. What is the difference between static and dynamic binding? Could you give a quick example of each to further illustrate it?
Tonsillotomy asked 13/3, 2009 at 0:10

1

A list in Python is now implemented as dynamic array of pointers, so it's not suitable for insertion and deletion at the front end. However, ring buffer also supports O(1) indexing. It can also exp...
Nigritude asked 20/2, 2017 at 16:12

© 2022 - 2024 — McMap. All rights reserved.