Questions tagged [language-design]
Questions involving the design and structure of programming languages.
493 questions
1 vote
3 answers
574 views
Why does C allow escaping apostrophes / single quotation marks in string literals
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 ...
11 votes
6 answers
3k views
Is there precedent for a language that allows the "early return" pattern to go between function call boundaries?
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 (...
2 votes
1 answer
382 views
Swift: What is the rationale behind forbidding named parameters for closures?
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&...
4 votes
5 answers
429 views
Why don't many languages implement an everything-before-is-a-comment symbol?
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 ...
-1 votes
2 answers
213 views
Could there be a <flex> tag?
<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 ...
0 votes
2 answers
318 views
Advantage of implicit/explicit declaration of global symbols (like functions)
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 ...
2 votes
1 answer
493 views
How to model opcodes effectively for a language VM?
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 ...
-1 votes
1 answer
188 views
Is it a good idea to let keywords have different lexical rules from names of types, variables, functions, etc? [closed]
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 ...