Live data from Hacker News

What you learn by making a new programming language

ntietz.com

21–30 of 137 posts

Re: What you learn by making a new programming language

#21
post #11

Earlier quoted context omitted.

> Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule

Is this a joke I'm not getting? Any examples of such software?

I think the point is that

- you write some piece of software

- then you add a straightforward configuration language

- then you add variables because you don't want too much copy/paste

- then you add if statements to allow conditional configuration

- then you add loops because you are sick of seeing configuration that consists of unrolled loops

- ...

At some point your configuration system is Turing complete, so could be considered a programming language. However it was never designed as such, so it is not a horrible one

TeX would be a good example of this. Ansible playbooks are (I believe) Turing complete, and YAML itself has such a huge spec, that if it isn't Turning complete and/or self aware already, I can't imagine it'll be long before it is

Re: What you learn by making a new programming language

#22

No. No, I really shouldn't. Yes, I might gain a better understanding of how things work. I can do that lots of ways; others may be a better use of my limited time. (For that matter, doing other things that don't give me a better understanding of how things work may be a better, more valuable use of my limited time.) Yes, I could get a language that fits what I need better... in theory. In practice, it would be buggy,…

The article doesn't claim that you should make a language and actually use it - the author focuses on the learning experience. He makes valid points.

No, it's probably not the right learning experience for everyone (clearly, it won't be yours), but there's definitely value in it for some people. And if reading the article nudges a few more people to take that learning dive, I think that's a good thing.

Re: What you learn by making a new programming language

#23
post #5

Earlier quoted context omitted.

Angry upvote. Maybe it's true failing though was stopping short of becoming the OS.

It's not its own kernel, but emacs can run on Linux as PID 1, at which point it rather seems like it should count as an OS. Given its affiliation, emacs/Linux probably still counts as GNU/Linux, but still...

I say if it's not running as the kernel, it's not an OS.

Otherwise you could "boot to" any terminal app.

Nano? OS. Cat? OS. Echo? Believe it or not, OS. Good grief.

Re: What you learn by making a new programming language

#24
The timing of this article is great for me as lately I'm fascinated by the Forth language and the simplicity behind its apparent strangeness. I've been tempted to start playing with similar ideas just for fun.

(https://ratfactor.com/forth/the_programming_language_that_wr... is a great read, btw.)

Re: What you learn by making a new programming language

#25
I think maybe a good middle ground is write an interpreter for an already spec'd esoteric language like brainfuck. [0]

It's really fun. Brainfuck specifically is great because there's a lot to optimize with only 6 total operations. (An example, multiplication has to be done as repeated addition in a loop, make a multiply AST node! [1]) and you could knock out a (BF => AST => Anything you want) compiler in an afternoon!

Bonus, there's a lot of really impressive brainfuck scripts out there. Nothing compares to seeing your compiler take in some non-sense ascii, and spit out an application that draws the mandlebrot fractal.

[0] https://esolangs.org/wiki/Brainfuck

[1] https://github.com/graypegg/unfuck/blob/master/src/optimiser...

Re: What you learn by making a new programming language

#26
I haven't made a programming language (and never will), but I did build a BNF-inspired metalanguage for describing text and binary formats to scratch the itch of trying to describe a binary data format I was developing:

The metalanguage: https://dogma-lang.org/

It's even got a syntax highlighter: https://marketplace.visualstudio.com/items?itemName=ksteneru...

The binary format I wanted to describe: https://github.com/kstenerud/concise-encoding/blob/master/cb...

Re: What you learn by making a new programming language

#28
post #16
post #10

Earlier quoted context omitted.

How is using a language that is buggy, inconsistent, and incomplete any better than use a better language to write an app that is buggy, inconsistent, and incomplete? Checkmate.

Umm if we are looking for analogies. I would prefer a castle built on rock rather than one built on sand.

Better than a sandcastle built on a rock, I suppose...

Re: What you learn by making a new programming language

#29
post #16
post #10

Earlier quoted context omitted.

How is using a language that is buggy, inconsistent, and incomplete any better than use a better language to write an app that is buggy, inconsistent, and incomplete? Checkmate.

Umm if we are looking for analogies. I would prefer a castle built on rock rather than one built on sand.

> rather than one built on sand

Well, that is exactly what your app is if it's built on modern "state of the art" tooling - you're probably pulling in a thousand trivial dependencies; every day, something gets updated, and you're rolling dice on whether or not your program will build.

Writing your own language to build your app in creates a lot of big problems, but not those particular problems.

Re: What you learn by making a new programming language

#30
post #10

No. No, I really shouldn't. Yes, I might gain a better understanding of how things work. I can do that lots of ways; others may be a better use of my limited time. (For that matter, doing other things that don't give me a better understanding of how things work may be a better, more valuable use of my limited time.) Yes, I could get a language that fits what I need better... in theory. In practice, it would be buggy,…

How is using a language that is buggy, inconsistent, and incomplete any better than use a better language to write an app that is buggy, inconsistent, and incomplete? Checkmate.

Different context, though. I'm pretty sure that my Java/Go/Kotlin apps are buggy. So what, bugs are always exist. Just fix them. But as a language user, it's not my job to fix compiler/RTL library bugs. Write a bug report on GitHub, instead.

But when you are designing a programming language and writing the interpreter/compiler, well you are on your own :D

Post reply on HN