Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Martin Ward Newsgroups: comp.compilers Subject: Re: What attributes of a programming language simplify its implementation? Date: Sat, 1 Oct 2022 15:56:49 +0100 Organization: Compilers Central Lines: 58 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <22-10-002@comp.compilers> References: <22-09-026@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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 X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <22-09-026@comp.compilers> Content-Language: en-GB Xref: csiph.com comp.compilers:3180 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