Skip to main content

Questions tagged [language-design]

Questions involving the design and structure of programming languages.

Filter by
Sorted by
Tagged with
1 vote
3 answers
578 views

As far as I can tell, the strings "It's me" and "It\'s me" are always identical. There seems to be no reason when a programmer needs to escape '. Yet, I could not find and ...
user2468852's user avatar
5 votes
4 answers
351 views

Background C++ attributes are a useful way to document assumptions and intent within code, and to prevent warnings. (e.g. [[fallthrough]]) Now, the Core Guidelines recommend to For “in” parameters, ...
Martin Ba's user avatar
  • 7,861
11 votes
6 answers
3k views

Here's some C# that should illustrate what I'm asking. Thing FindThing(string key) { // Search for the thing with the right key. foreach (Thing th in things) { // Found it? if (...
billpg's user avatar
  • 729
1 vote
1 answer
114 views

The title Go, Error Handling, and Big Text Files is a blog post from Wesley Aptekar-Cassels from 2021. In this blog post he reports about a problem he faced parsing long text files. He tried scanner :=...
surfmuggle's user avatar
2 votes
1 answer
383 views

In Swift, functions can be defined with named parameters, for example: func greet(person: String) -> String { ... } which need to be used when the function is called : greet(person: "Anna&...
DarkTrick's user avatar
  • 286
5 votes
2 answers
739 views

In Python when you want a local variable, you just assign to it x = 10. In most modern languages you declare local vars (regardless of type): JavaScript: let/const/var Swift: let/var Kotlin: val/var ...
noamtm's user avatar
  • 235
4 votes
5 answers
429 views

Python and PowerShell use # to denote to the parser that everything after them until the line break is a comment. They even provide block comments for multiline situations. However, there is no ...
RokeJulianLockhart's user avatar
0 votes
0 answers
122 views

It's been a long time that I had an idea of a semantic constraint as compiler optimizations which allows for sophisticated high level optimization allowing you to transform the AST/CFG based on a SFG (...
C5H8NNaO4's user avatar
  • 129
-1 votes
2 answers
213 views

<div> tags are display: block per default. <span> tags are display: inline per default. Could there be a tag that is display: flex per default? I don't mean a class, like bootstrap has. I ...
Lycodo's user avatar
  • 13
0 votes
1 answer
186 views

I am thinking about how to build a language VM. I have been able to get some of the basic constructs right, including jumps to functions within the chunk of bytecode that is currently loaded. But now ...
mydoghasworms's user avatar
0 votes
2 answers
319 views

In C and C++ we need to declare a function before its usage, if its definition comes after where it is called. (Well, there is also the "implicit declaration" rule in C, but it is rarely ...
Ma Joad's user avatar
  • 101
5 votes
1 answer
2k views

This is a clarification of a closed question. I've limited the scope as requested. First, a few definitions, following e.g. A modular module system. Consider any programming language with a selected ...
Corbin's user avatar
  • 146
2 votes
1 answer
495 views

I am learning about building a language VM with the long-term goal of writing an own language. For guidance, I am looking at this LC3 tutorial by Justin Meiners and Building a Language VM by Fletcher ...
mydoghasworms's user avatar
1 vote
5 answers
847 views

Why is there a such thing as import in programming languages? If a package does not exist, then trying to import it would cause an error anyway. So why don't languages just auto import ALL available ...
user1345541's user avatar
-1 votes
1 answer
188 views

For example, keywords have a special prefix. Objective-C has @interface, @implementation, but that's for compatibility with C. It inherits all the C keywords of course, with no @. How about a language ...
Eugene's user avatar
  • 117
5 votes
1 answer
576 views

In the code snippet found in this tweet, pattern matching is used like this: let (|x| x) = |_| Some(1); // same as `let (x | x) = |_| Some(1);` Which threw me off. Rust's pattern syntax is defined as:...
Calo's user avatar
  • 63
38 votes
10 answers
10k views

As has been covered to the point of parody, heavily object-oriented languages, such as C# or Java, tend to lack the feature of having functions as a primitive type. You can argue about whether or not ...
J. Mini's user avatar
  • 1,015
1 vote
1 answer
117 views

Processors have come a long way in their handling of unaligned data - from crashing at the very notion of it, through suffering severe penalties, all the way to having almost no impact. I suppose it ...
dtech's user avatar
  • 763
3 votes
4 answers
1k views

By "Automatic Reference Counting", I am refering to the specific feature of the Clang compiler. By "Garbage Collection", I am refering to Tracing Garbage Collection, not to "...
Curious's user avatar
  • 95
4 votes
3 answers
1k views

I've been trying to better understand (at least at a high level) why the early versions of HTML were designed the way they were. Most of the decisions make sense; I can deduce (at least at a high ...
Mathew Alden's user avatar
7 votes
6 answers
3k views

In C#, we have delegates, which are essentially variables (holders) for methods that follow a signature. So, I could write delegate void MyDelegate(int num); MyDelegate myMethodHolder; Now, ...
Ben I.'s user avatar
  • 181
3 votes
3 answers
1k views

This question is mostly related to the way language implementer do implements static class initalization (pretty specialized question). It is for curiosity and also to potentially improve my code to ...
Eric Ouellet's user avatar
2 votes
1 answer
186 views

Does there exist some language whose execution model is implemented as a neuron network, or maybe as some other type of a network/grid (e.g. network of finite automata)? That is, specifically, without ...
Al Berger's user avatar
  • 279
0 votes
2 answers
1k views

To my understanding, C does not have the concept of objects, then how can Python be implemented in C to support something that C can not? How is the concept of "Object" modeled in C? What is ...
Alice's user avatar
  • 39
2 votes
1 answer
149 views

I am implementing anonymous functions (lambdas) in a scripting language that supports hot reloading. The language currently supports passing user defined functions (pointers) to plugin functions which ...
korri123's user avatar
  • 141
4 votes
4 answers
1k views

I'm going through a beginner programming learning guides and the teacher brings up the try catch block paradigm. The code you put in the try block is run and if an error happens the code in the catch ...
1.21 gigawatts's user avatar
8 votes
1 answer
406 views

SQL Server documentation uses this notation, which is very easy to understand and consume. Is this a BNF Syntax Diagram? Or is this a different type of notation? Source: SQL server documentation page ...
user497745's user avatar
9 votes
6 answers
2k views

The standard way that types are handled in programming languages that have such a concept, is that they are: removed entirely at compile time and are just used to determine memory layout, function ...
AIWalker's user avatar
  • 1,365
-1 votes
1 answer
99 views

Given the following hypothetical programming language: Intended for practical programming A simply typed lambda calculus (STLC) All objects are functions, based on Church encodings I am aware that ...
Ari Fordsham's user avatar
6 votes
5 answers
7k views

I know that some languages like APL have a dedicated NAND operator, but I'm thinking about languages like C, C++, Java, Rust, Go, Swift, Kotlin, even instruction sets, etc. since these are the ...
Ky -'s user avatar
  • 565
0 votes
3 answers
1k views

A few weeks ago, I went on Udemy course on Swift, the instructor mentioned that constants are called let in Swift because it's standard in OOP (JavaScript uses it for example). I know this may seem ...
Laurens van Oorschot's user avatar
67 votes
9 answers
9k views

Java has "checked exceptions", which force the caller of the method to either handle an exception or to rethrow it, e.g. // requires ParseException to be handled or rethrown int i = ...
Heinzi's user avatar
  • 9,868
-1 votes
1 answer
206 views

This question is asking about a generally applicable engineering principle. It is using T-SQL as a specific example, but the question is about the engineering principles behind major SQL dialects in ...
Panzercrisis's user avatar
  • 3,223
3 votes
1 answer
200 views

My aim is to create a language specific to the scientific field (which would be used mainly in the field of machine learning and physics) which would be based on the functional paradigm, a paradigm ...
Foxy's user avatar
  • 621
6 votes
5 answers
1k views

For the designer of a language syntax, what are some reasons to choose a repeated delimiter to escape that delimiter, instead of having a separate escape character to escape that delimiter. A common ...
Shiania White's user avatar
1 vote
1 answer
125 views

Here is a concrete example of what I'm asking about: MutableList[ImmutableList[Object]] Where ImmutableList is covariant wrt its first parameter, but MutableList is invariant wrt its first parameter. ...
Beks_Omega's user avatar
1 vote
4 answers
1k views

Short answer that I've come to accept: Firstly, it helps with readability, being able to see which is the superclass apart from interfaces. Secondly, though 'extends' and 'implements' do the same ...
xtratic's user avatar
  • 456
5 votes
1 answer
446 views

C++ supports protected inheritance: A class can derive from a base class B in a way that the "outside" world doesn't see that class "as a B" but the class itself and it's derived ...
Daniel Jour's user avatar
1 vote
2 answers
408 views

Is there a statically typed programming language that implements Polymorphism without using a superclass or an interface (if such implementation is even possible)?
Steve's user avatar
  • 119
0 votes
1 answer
170 views

I'm working on a programming language design ans I'm struggling with how I should type the concept of Class. Let me show you some code to illustrate my problem : class MyClass { } function ...
ibi0tux's user avatar
  • 241
2 votes
4 answers
269 views

I am planning to design a programming language. One challenge I face with is whether it is a good idea to have const as a variable qualifier instead of a type qualifier. For example in C++: const int ...
Andrea's user avatar
  • 29
10 votes
4 answers
2k views

The title is deceptive; the question is really "why does C++ have classes and not only structs?" Often, people ask why C++ has structs if they are functionally equivalent to classes. The answer is (...
Chayim Friedman's user avatar
1 vote
1 answer
519 views

(This question isn't a duplicate of Why do we need the async keyword? - it's more of the opposite: I'm not questioning the async keyword - I'm asking if compilers could elide the use of await ...
Dai's user avatar
  • 678
94 votes
11 answers
21k views

AFAIK, Option type will have runtime overhead, while nullable types won't, because Option time is an enum (consuming memory). Why not just mark optional references as optional, then the compiler can ...
Chayim Friedman's user avatar
1 vote
2 answers
2k views

Is there a logical reason why the integer is upgraded to 32+ bits? I was trying to make an 8bit mask, and found myself a bit disappointed that the upgrade will corrupt my equations. sizeof( quint8(0)...
Anon's user avatar
  • 3,649
4 votes
1 answer
699 views

I'm currently writing a small language of my own, and have been considering the difference between the C++ style, where the access modifier applies to a block of members, and the C#/Java style, where ...
Andrew Williamson's user avatar
2 votes
1 answer
306 views

Why did c++11 add a separate find_if() instead of simply overloading the existing find()? Wouldn't overloading the function be sufficient?
Jankovsky144's user avatar
0 votes
4 answers
287 views

I'm currently designing a database query language and I came to wonder what should be the best syntax for the comparison operator. Most modern languages use ==, but amongst the database languages ...
ibi0tux's user avatar
  • 241
50 votes
5 answers
12k views

According to my experience, Wikipedia and prior answers, a scripting language is vague category of languages which are high-level (no manual memory management) and interpreted. Popular examples are ...
Seanny123's user avatar
  • 663
-4 votes
1 answer
386 views

I'm writing a parser that needs to accept unstructured input. By that I mean it needs to take in a raw signal (text, in this case) and look for significant character sequences while accumulating the ...
dopatraman's user avatar

1
2 3 4 5
10