Stack Exchange
log in sign up chat discuss faq users badges

Area 51 » Technology

173
followers
Follow It!
Share This

Programming Language Design and Implementation

Proposed Q&A site for designers and implementers of computer programming languages
flag

1
vote
2
answers

Why are so many example questions downvoted?

2d ago Original Original Original VI 302
2
votes
1
answer

Should we allow questions on literature about programming language design/implementation?

jan 20 at 14:37 warren 7,628
6
votes
2
answers

Should we rename our site to include “and implementation”?

jan 18 at 12:27 lyxal 426
5
votes
2
answers

Should “should” questions be allowed?

jan 12 at 20:04 Karl Knechtel 151
3
votes
1
answer

Should questions about design decisions in existing languages be on-topic?

jan 11 at 17:53 Redwolf Programs 1,096

show 10 more discussions
discuss this proposal

116 Example Questions (7 closed)

active newest votes
up vote 19 down vote
What are the advantages/disadvantages of implementing strings as character arrays?
added by emanresu A Nov 17 '22 at 23:52
link|flag
This seems like a fine question to me, equally subjective as all the other advantages/disadvantages questions here – mousetail Nov 19 '22 at 6:06
2  
What is a character? – user3840170 Nov 19 '22 at 12:13
@user3840170 a single code point. Depending on the language it could be either a ASCII character like "a" or "$" or a Unicode code point. A series of characters is called a string. – mousetail Nov 19 '22 at 12:48
1  
This question is a bit unclear, and could use rewording: Are we talking about making strings a user-facing character array? Or are we talking about the inner guts: using a character array vs byte array internally? – Nathan Merrill Dec 1 '22 at 19:50
5  
If 10 users pulled their upvotes from this question, moving them to others closer to the threshold, the proposal will have a better chance of progressing – warren Jan 20 at 14:42
show 8 more improvement suggestions
up vote 14 down vote
What are the advantages of compiling vs. interpreting a language?
added by Redwolf Programs Nov 17 '22 at 22:59
link|flag
up vote 14 down vote
What is a generational garbage collector and what are its benefits?
added by mousetail Nov 18 '22 at 15:49
link|flag
up vote 13 down vote
How would you design a compiler upfront to be both a compiler and a Language Server Protocol server?
added by gavinhoward Nov 18 '22 at 15:06
link|flag
up vote 12 down vote
What are the upsides of using explicit line-ending characters (like semicolons) as opposed to newlines?
added by Ginger Nov 17 '22 at 23:01
link|flag
Limiting only to semicolons seems... weird. Potentially could be rephrased to ask about explicit line-ends vs using newlines to end a line to be a more general question – caird coinheringaahing Nov 19 '22 at 2:00
up vote 10 down vote
Is there a widespread alternative to C-style or Python-style code block syntax?
added by Redwolf Programs Nov 17 '22 at 23:00
link|flag
2  
This is a yes/no question. Maybe ask "What are the widespread alternatives to C-style or Python-style code block syntax?" – Adám Nov 21 '22 at 8:29
3  
@Adám list type question, like yes/no ones, are generally bad fits for the SE format – warren Nov 21 '22 at 13:43
@warren area51.meta.stackexchange.com/questions/32832/… – mousetail Nov 21 '22 at 15:27
1  
@mousetail - they"re still generally bad fits for SE sites. Just because there are a couple notable exceptions doesn't change the general rule :) – warren Dec 1 '22 at 13:40
@warren please answer the linked question then, it's a much better place for this discussion than the comments here – mousetail Dec 1 '22 at 13:42
up vote 10 down vote
Could a Rust-style borrow checker work based on compiler inference?
added by Redwolf Programs Nov 17 '22 at 23:01
link|flag
up vote 10 down vote
How can I compile a register machine-based IR to WASM?
added by Olive Nov 17 '22 at 23:27
link|flag
3  
This doesn't seem on-topic. How to implement a compiler for some other pre-existing IR is not programming language design. – curiousdannii Nov 21 '22 at 7:37
12  
but it is part of programming language implementation. note "Proposed Q&A site for designers and implementers..." – Seggan Nov 21 '22 at 15:13
up vote 10 down vote
What are common ways to optimise an interpreted language?
added by emanresu A Nov 17 '22 at 23:36
link|flag
11  
I'm not sure that I agree this should be closed. SO disallows list questions, sure, but I think this would work pretty well on our site, similar to CGCC's tips questions, which collect large numbers of answers on specific tricks just like this one would – Redwolf Programs Nov 19 '22 at 17:15
up vote 10 down vote
How could custom infix operators be implemented in a parser?
added by emanresu A Nov 18 '22 at 0:08
link|flag
I think most of the close votes on this are misunderstanding the question. It's not asking about implementing "custom"/nonstandard infix operators as a language designer, which could be done a zillion ways, it's talking about custom operators defined by the program itself, which is a more interesting problem and probably one with fewer good answers – Redwolf Programs 2 days ago
up vote 10 down vote
What rules can one use for semicolon inference?
added by Original Original Original VI Nov 18 '22 at 1:19
link|flag
up vote 10 down vote
Advantages of transpiling to a high-level language vs compiling to VM bytecode or LLVM IR
added by Original Original Original VI Nov 18 '22 at 1:28
link|flag
up vote 10 down vote
Advantages of extension methods vs UFCS
added by Original Original Original VI Nov 18 '22 at 1:32
link|flag
up vote 10 down vote
How do I parse an indentation-aware language like Python or Haskell?
added by Bubbler Nov 18 '22 at 1:58
link|flag
3  
This feels a little vague to me (depending on which library you're using for the parser, the solution could vary greatly). Maybe the question could be about writing the BNF for such a language? – Original Original Original VI Nov 18 '22 at 18:32
I think that its called the "off-side" rule :) – TKirishima Nov 18 '22 at 23:08
2  
This seems like a suitable question, but the answer is that it's more about lexing than parsing; you want the lexer to output tokens representing "increase indentation level" and "decrease indentation level", and you then parse those as if they are "open block" and "close block" tokens as normal. So it's not really a question about BNF, the BNF for the language is the same as if { and } were your block delimiters. – kaya3 Nov 19 '22 at 2:58
4  
kaya, it doesn't make the question any less a fit for this site – Seggan Nov 19 '22 at 14:42
up vote 10 down vote
How to run a lazy and pure-functional language efficiently?
added by Bubbler Nov 18 '22 at 2:12
link|flag
up vote 10 down vote
Why would you choose a LLVM over a GCC back-end or vice versa for a compiled language?
added by mousetail Nov 18 '22 at 11:26
link|flag
up vote 10 down vote
What is the difference between LL (1) and PEG parsers?
added by Ginger Nov 18 '22 at 13:21
link|flag
9  
This question, along with a lot of others, would be pretty well served on CS.SE as it is, don't you think? – pxeger Nov 20 '22 at 7:55
up vote 10 down vote
How do I turn this left-recursive grammar rule into a rule that isn't left-recursive?
added by lyxal Nov 18 '22 at 13:40
link|flag
up vote 10 down vote
How do I properly design multiple inheritance in a programming language?
added by lyxal Nov 18 '22 at 13:42
link|flag
1  
Which form of multiple inheritance? A->B->C->D, or A->B, G->H, and (H+B)->Q? – warren Dec 1 '22 at 13:47
@warren I've never seen A->B->C->D referred to as multiple inheritance – Redwolf Programs Jan 10 at 14:24
@RedwolfPrograms - I heard it called that when I first hit OOP back in the 90s. Maybe it isn't still? – warren Jan 10 at 15:22
2  
Aside from terminology, I can't really imagine a reason why supporting A->B->C inheritance requires any special effort once A->B is supported; whereas (A + B)->C does (because of object layout issues). – Anonymous Jan 12 at 19:48
worth noting there's no single correct answer on how to do multiple inheritance in general. and so this question may end up looking more like a [tips] question? – somebody yesterday
up vote 10 down vote
When should I prefer utf-16 or utf-8 (or something else) for internal string representation?
added by mousetail Nov 18 '22 at 14:09
link|flag
2  
UTF-32 is also an option. – Adám Nov 19 '22 at 18:18
up vote 10 down vote
Should types be a first class value?
added by fess Nov 18 '22 at 14:34
link|flag
18  
I think this question would be better phrased as "What are the advantages of types as a first class value" or "what kinds of programming languages would benefit from first class types", right now it's a vague question that opens the way to vague answers. – Pavel Nov 18 '22 at 19:08
3  
@Pavel Also "It's clearly possible to make types first class (e.g. Zig) so what are the pitfalls that prevent it being done more often?" – finnw Nov 23 '22 at 10:52
up vote 10 down vote
How do you check whether an inferred type matches a type signature?
added by Jon Purdy Nov 18 '22 at 17:49
link|flag
up vote 10 down vote
Is there any agreed upon syntax for dependent types (e.g., integer ranges, string alphabet)?
added by BoppreH Nov 18 '22 at 18:27
link|flag
up vote 10 down vote
How do first-class functions get compiled down to assembly?
added by Nathan Merrill Nov 18 '22 at 21:20
link|flag
1  
What is a first-class function? – user3840170 Nov 19 '22 at 13:05
6  
It is a function that can be passed around as data – Seggan Nov 19 '22 at 14:39
This seems a bit vague or unclear. Since it's data, "compiled" sounds off. While it's certainly possible to explain a process for implementing the feature and compiling a language that supports them directly to assembly, it comes across that the person asking might have some misconceptions that prevent clear communication. It would, I suppose, depend on the body of the question. – Anonymous Jan 12 at 19:46
up vote 10 down vote
Is it good practice to have the concept of a "statement" distinct from a expression?
added by lyxal Nov 19 '22 at 6:46
link|flag
1  
Since this has collected 4 close votes and discussion about "should" questions is ongoing, it might be worth rewording this to focus more on the "why or why not" or "advantages/disadvantages of" – Redwolf Programs Jan 10 at 15:00
1  
@redwolfprograms I've edited it to not use should – lyxal Jan 11 at 3:44
up vote 10 down vote
How are programming languages with customizable notation like Coq or Agda parsed?
added by Agnishom Chattopadhyay Nov 21 '22 at 15:32
link|flag
up vote 10 down vote
What parsing/readability downsides occur when allowing identifiers to contain non-Roman characters, such as Greek, Hebrew, Arabic, or CJK characters?
added by Robert Columbia, edited by warren Dec 1 '22 at 13:45
link|flag
up vote 8 down vote
Why did language <x> choose to have feature <y>
added by lyxal Nov 17 '22 at 23:01
link|flag
3  
It is indeed a stand-in for any specific language x and language feature y. – lyxal Nov 22 '22 at 21:42
3  
Only the language creator can really answer this. Everyone else can only speculate. – finnw Nov 22 '22 at 22:56
5  
@finnw That's not generally true; we can know why some languages have some features because the language designers explained their rationale for including those features, e.g. in RFCs, PEPs/JEPs, issue tracker discussion threads, mailing lists, Usenet forums, public talks, academic papers, source code comments, or any number of other sources. So in many cases, such questions can be answered with reference to facts rather than speculation (though informed speculation can often be useful, too). – kaya3 Nov 24 '22 at 5:19
1  
@warren I see no reason why knowledge from what the designers and implementers of popular languages have said about those languages should be off-limits for a Stack Exchange site meant for sharing knowledge about language design and implementation. The point is that that knowledge can be shared without requiring those specific individuals to write it here themselves. – kaya3 Dec 1 '22 at 20:18
1  
@warren In a trivial, irrelevant sense, you are correct if you also define an answer quoting somebody else as an answer given by that person. But (1) that is just not what "answering a question" means on Stack Exchange (the person who wrote the answer and whose profile name, avatar and reputation appear on that answer is the person who answered the question), and (2) it is totally clear from context that the comment you are defending does not define "answering" in that way, otherwise it would make no sense as an objection to this question belonging on the site. So it seems to me that you ... – kaya3 Dec 5 '22 at 14:14
show 17 more improvement suggestions
up vote 8 down vote
What are the syntax options for implementing a ternary "if" operator?
added by Ginger Nov 17 '22 at 23:04
link|flag
2  
This is a bit vague. I initially read it as discussing different syntax that can be used, but now I read it as having more to do with implementation (e.g., laziness/forking). Which is it? – Redwolf Programs Nov 27 '22 at 4:15
Syntax. I have clarified. – Ginger Nov 30 '22 at 15:12
1  
Would this question be simply looking for examples? Most languages go for a <condition> ? <true> : <false>, <condition> -> <true>, <false>, <condition> : <true> ⋄ <false>, if <condition> then <true> else <false>, <condition> ifTrue: <true> ifFalse: <false> or even WHEN <condition> THEN <true> ELSE <false> construct/variation, with or without fi/END stops, but you can use any characters/order you wish, naturally. What kind of limit is the question looking for? – Mast Dec 14 '22 at 13:05
up vote 8 down vote
Why does Rust have different error types for libraries and applications?
added by BoppreH Nov 18 '22 at 18:42
link|flag
3  
Wait, it does?? – user3840170 Nov 19 '22 at 12:16
3  
@user3840170 By community agreement, yes: nick.groenen.me/posts/rust-error-handling/… – BoppreH Nov 19 '22 at 20:04
up vote 8 down vote
Should my language have a type for single characters?
added by BoppreH Nov 18 '22 at 18:54
link|flag
This is essentially the same as this: area51.stackexchange.com/proposals/127456/… – mousetail Nov 19 '22 at 6:33
4  
@mousetail I disagree, the linked question requires having a character type, but having a character type doesn't imply that strings are just arrays. – BoppreH Nov 19 '22 at 20:02
3  
Rust is an example of a language which has separate types for strings and characters, but in which strings are not arrays of characters (they are arrays of bytes, UTF-8 encoded, so each character may be 1-4 bytes). – kaya3 Nov 22 '22 at 7:37
1  
@mousetail I also disagree: implementing a string as an array of "characters" internally doesn't imply that the character type is exposed. – Anonymous Jan 12 at 19:49
1  
@RayButterworth no. For example, in Java, char is a 16-bit unsigned type intended to store a UTF-16 value (code point or half of a surrogate pair).Bytes are not characters, just as data is not text. The question is about the decision made by Java (and many others) to have char exist as an exposed-to-the-user type separate from String, as opposed to the decision made by Python and Javascript (and probably others I can't think of right now) whereby indexing a string results in a string of length 1. – Anonymous Jan 12 at 19:52
show 4 more improvement suggestions
up vote 8 down vote
Is it possible to extend C to have the Rust concept of ownership for memory safety?
added by James Risner Nov 20 '22 at 0:39
link|flag
up vote 8 down vote
What are the advantages of advantages/disadvantages of null-terminated strings vs storing strings' length in memory?
added by justANewbie Dec 13 '22 at 6:10
link|flag
up vote 8 down vote
What compilation techniques for algebraic effects and handlers are known that focus on producing practical efficient code?
added by Andrej Bauer Dec 14 '22 at 18:18
link|flag
up vote 8 down vote
Since lazy-evaluation is, after the presence of Haskell, rarely used in popular languages, is it considered a bad feature now? For what reasons?
added by ice1000 Dec 15 '22 at 19:22
link|flag
up vote 7 down vote
How can I show multiple parse errors at once?
added by Bubbler Nov 21 '22 at 6:23
link|flag
up vote 7 down vote
My esolang uses the 4 pairs of ASCII bracket characters `(){}[]<>`, and it needs more. What options in Unicode are there for balanced pairs like this?
added by bigyihsuan Dec 5 '22 at 20:55
link|flag
up vote 6 down vote
How should I specify my language to make sure implementations will not use undefined behaviour as an excuse to miscompile code?
added by user3840170 Nov 19 '22 at 12:25
link|flag
2  
What kind of scenario is this imagining? – Unrelated String Nov 21 '22 at 7:29
Deleting null pointer checks, code working ‘fine’ at -O0, but not at -O3, compilers disproving Fermat’s last theorem… maybe you, as a language designer, are thinking: welp, C is broken beyond repair, but maybe if I am designing my own language, I can prevent other people from playing word games with my spec. Of course the answer should explain that it is not as simple as a ‘don’t you dare optimize my code’ clause. – user3840170 Nov 21 '22 at 7:58
3  
There is a famous article by Raymond Chen explaining how undefined behaviour can result in "time travel", and there is also the meme which says undefined behaviour gives the compiler permission to make demons fly out of your nose. The idea is that a compiler is free to assume that a program it's compiling will never perform undefined behaviour, even if the compiler can't prove it, and that leads to strange and often undesirable results when the assumption is violated. So the question is how to avoid that. – kaya3 Nov 22 '22 at 7:49
@kaya3 if I remember correctly the C meme about U.B., it says: "it summons demons fly out of your nose, or launch a nuclear missile". I think that depict the whole picture of safety :-) – Stephane Rolland Dec 28 '22 at 13:53
up vote 6 down vote
How could a language mitigate overflow concerns when optimizing arithmetic, either through the type system or compiler-level reasoning?
added by Unrelated String Nov 22 '22 at 8:44
link|flag
related: area51.stackexchange.com/proposals/127456/… – warren Dec 5 '22 at 15:59
up vote 4 down vote
What other mechanisms for errors exist other than try-throw-catch?
added by Seggan Nov 22 '22 at 15:24
link|flag
I can only think of three or four; I doubt this question is actually too broad. You've got the "try-throw-catch" family, you've got interrupt-handler-style, you've got (success | failure) sum types, you've got errno… and that covers it. Not a list question. – wizzwizz4 Jan 29 at 19:34
1  
There may be only so many ways to do it, but I think this is still a valuable question for comparing the pros and cons of different approaches. How a language handles errors can greatly impact how people use it, and it may require changing other features to work more smoothly with it. – Original Original Original VI Jan 30 at 3:43
1 2 3 next

Log in or register to propose your own example question!

This proposal is in:

Definition

The topic and audience are still being decided. It needs:

  • 0 more followers
  • 13 more questions with a score of 10 or more

to move to the next phase.

proposed by

Redwolf Programs
31.5k●7●142●357

2 months ago

edited by

warren
105k●95●527●1144

13 days ago

viewed

5,851 times

latest activity

today

followers

users also following

8.1% Cryptocurrency
5.2% Agriculture
3.5% Drones and Model...
3.5% Proof Assistants
61.8% only this proposal

followers active in

39.9% Stack Overflow
22.5% Meta Stack Exchange
17.3% Code Golf
16.2% Mathematics
12.1% Super User
12.1% Code Review

recent followers

added yesterday
user223485
51●1
added yesterday
user223483
51●1
added Jan 30 at 10:15
Nimesh Neema ♦ 1
60.2k●27●207●330
added Jan 29 at 19:24
wizzwizz4 ♦ 1
42k●12●190●513
added Jan 29 at 9:39
user223477
51●1
added Jan 29 at 6:07
goomba
51●2
added Jan 28 at 15:15
Roan
1,351●2●23●35
added Jan 28 at 14:59
user223469
51●1
added Jan 25 at 20:12
taylor.2317
3,354●1●18●119
added Jan 25 at 17:18
warren
105k●95●527●1144
added Jan 24 at 5:06
just Paul
51●1
added Jan 23 at 11:24
user223454
51●1
added Jan 22 at 22:09
Riley Lynch
51●2
added Jan 22 at 14:50
Thanga akilan
876●2●9
added Jan 16 at 18:04
stackprotector
13.5k●15●60●170
added Jan 16 at 13:53
Jacob
51●1
added Jan 16 at 11:12
Number Basher
2,156●1●4●64
added Jan 16 at 8:03
iwein
27.4k●11●75●148
added Jan 15 at 1:21
Logan Devine
3,106●1●12●33
added Jan 14 at 18:30
user223425
51●1
added Jan 12 at 18:58
user223417
49●2
added Jan 12 at 18:14
Etungano Kiza
51●2
added Jan 11 at 9:14
Alexis Dufrenoy
20.3k●15●139●278
added Jan 11 at 9:06
user223401
51●1
added Jan 10 at 16:34
Julia
1,955●1●8●24
added Jan 10 at 3:57
RedzGoose
1,170●1●29
added Jan 6 at 23:31
user223392
51●1
added Jan 5 at 5:11
kku
1,578●1●13●57
added Jan 4 at 12:27
Thisaru Guruge
4,679●8●50●94
added Jan 4 at 4:48
Justaus3r
573●5●16
added Jan 2 at 17:04
Groot
51●2
added Jan 2 at 16:04
user223380
51●1
added Jan 2 at 11:25
nairboon
2,037●14●43
added Jan 2 at 11:15
Plecra
51●2
added Jan 1 at 18:01
user223375
51●1
added Dec 31 '22 at 14:56
user223372
51●1
added Dec 31 '22 at 14:49
user223371
51●1
added Dec 31 '22 at 2:55
AviFS
47●1
added Dec 30 '22 at 10:20
Jude
51●1
added Dec 28 '22 at 13:45
Stephane Rolland
62.5k●56●301●581
feed icon proposal feed
faq | blog | legal | privacy policy | contact us | feedback always welcome
site design / logo © 2023 Stack Exchange Inc; user contributions licensed under cc by-sa; see the licensing help page for more information.
rev 2023.1.23.613