Questions tagged [language-design]
For questions relating to the design of programming languages, including language semantics, syntax, type systems, data structures, or other design elements.
136 questions
16
votes
1
answer
2k
views
Why might C++ have been designed to make types like std::strong_ordering a class instead of an enumeration?
In C++, std::strong_ordering has four valid values, yet instead of being an enumeration, it is a class. This seems weird to me, for it prevents ...
1
vote
2
answers
334
views
How can I design a simple programming language from scratch? [closed]
want to design a simple programming language for educational purposes.
My goal is to understand the fundamentals of how a language works — defining syntax, grammar, and how code gets executed (...
2
votes
1
answer
163
views
Making datatypes for a programming language to translate (or compile) to an esoteric language
I'm making an "assembly language" called X that compiles from X to an esoteric language Y, but I encountered some problems with the data types for the variables.
I currently have three data ...
6
votes
5
answers
3k
views
What are the consequences of allowing breaking/returning from every statement?
One beneficial feature of Rust is that loop, the unconditional looping statement, allows so-called "returning break", ...
0
votes
0
answers
111
views
Object type definition from JSON - CFG design
In a "managed memory" language that I'm designing, I'm constructing grammar for the description of arbitrary object type that can simultaneously be used for initialization of objects with ...
4
votes
0
answers
203
views
Prior Art on implementing memory arenas or thread- or work-package-local allocators in systems programming languages
Local allocators can be beneficial in situations where tracking memory usage or releasing all allocated memory without running destructors at the end of an activity is possible. From that perspective, ...
7
votes
4
answers
772
views
What makes a language "golfy"?
For those not in the know, a golfing language is a language designed such that its programs can be written with as few bytes as possible.
With that in mind, what metric, what objective, do language ...
0
votes
2
answers
1k
views
“return(x);” vs. “return x;”
In most C-like languages, a call such as printf("%d", x) is followed by two parentheses; and I see that a statement such as ...
4
votes
4
answers
490
views
Would an algebraic effects system make sense in a dynamically or gradually typed language?
I am currently thinking about the design and implementation of a programming language. Initially, I was leaning towards a strongly and statically typed system, as found in languages such as OCaml or ...
4
votes
2
answers
448
views
How do immutable compilers like Roslyn handle cyclic references in type definitions?
I'm learning about how modern compilers like Roslyn handle symbol tables and type information. From what I understand, Roslyn uses immutable data structures to represent symbols, which helps ensure ...
1
vote
1
answer
395
views
How do you mathematically prove that programming languages and their embedded domain-specific languages are memory safe, like Rust?
How do you mathematically prove that programming languages and their embedded domain-specific languages are memory safe, like Rust?
Can you provide a sketch for such mathematical proofs?
I am aware ...
21
votes
5
answers
4k
views
The square bracket dance: declaring an array in Go, Java, C++ makes the bracket [] going from the left to right. What are the underlying motives?
I've learned multiple languages during my developer life. When I'm switching from one to another, I'm falling in plenty of "small things to remember". Some have a reason I'm knowing, but ...
15
votes
10
answers
3k
views
Are there any languages where you can make a variable update whenever a dependent value changes?
In a spreadsheet, like Google Sheets or Excel, if you make a formula which involves values from other cells, and update the value on those cells, the value on the cell with the formula will change, ...
5
votes
1
answer
1k
views
Semantics on `with` keyword in C# for (heap-based) records
I have a question about a C# language design. Let's have a following code:
...
0
votes
1
answer
532
views
Are there any programming languages that operate solely via side-effects?
Out of curiosity I checked how Google AI would respond to a similar question. The bot seemed clever enough to understand the question, but responded that functions in this case would have no return ...