Re: What attributes of a programming language simplify its implementation?

Martin Ward <martin@gkc.org.uk>
Sat, 1 Oct 2022 15:56:49 +0100

          From comp.compilers

Related articles
| List of all articles for this month |
From: Martin Ward <martin@gkc.org.uk>
Newsgroups: comp.compilers
Date: Sat, 1 Oct 2022 15:56:49 +0100
Organization: Compilers Central
References: 22-09-026
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="28266"; mail-complaints-to="abuse@iecc.com"
Keywords: design
Posted-Date: 01 Oct 2022 15:28:21 EDT
In-Reply-To: 22-09-026
Content-Language: en-GB

On 30/09/2022 12:46, Christopher F Clark wrote:
> What attributes of a programming language simplify its implementation.
>
> 1. Simple semantics. That's it. Simple semantics. (Simple meaning
> whatever is easy to implement. Not mathematical elegance. Not
> consistency.)


> sweep any hard semantics under the rug and don't worry about them.
> ... Label anything that doesn't
> work the way you want in your implementation, "undefined behavior".


This might be OK for a throw away student project (but I still
think students ought to understand the importance of elegance),
but for a production compiler/language that is going
to be used by lots of programmers for lots of projects,
it is a classic example of optimizing the wrong thing.


The tiny amount of time you saved with incomplete and inconsistent
behaviour is lost many times over as programmers spend hours debugging
weird behaviour, working around the missing or inconsistent semantics
and writing convoluted code to avoid undefined behaviour.


"Sweep any hard semantics under the rug": where the hackers can find
it and exploit the inevitable security holes created by the semantics
that your simple implementation happens to give you (that you labelled
as "undefined behaviour").


Make every single programmer who uses your compile do extra work in
every program they write, just so that you can save a little bit of
work in the design and implementation of your compiler because you
don't care about mathematical elegance or consistency.


C is filled with


> By the way Richard P Gabriel famously wrote about this, coining the phrase
> "Worse is better".


Gabriel argued that "Worse is better" produced more *successful*
software than the MIT approach. This is true, of course, but success
of bad software is a bad thing, not a good thing. Highly successful
bad software has been filling the columns of comp.risks ever since it
began.


What does this C code print:


unsigned int plus_one = 1;
int minus_one = -1;


if (plus_one < minus_one)
          printf("1 < -1");
else
          printf("boring");


--
Martin


Dr Martin Ward | Email: martin@gkc.org.uk | http://www.gkc.org.uk
G.K.Chesterton site: http://www.gkc.org.uk/gkc | Erdos number: 4


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.