Live data from Hacker News

Ask HN: Is there a simple and minimal language like C but without its footguns?

news.ycombinator.com

1–10 of 41 posts

Ask HN: Is there a simple and minimal language like C but without its footguns?

#1
I want to pick a new programming language that is simple and minimal like C but does not have the type of footguns C has (segmentation faults, double-free issues, etc.)

C++, Java, Rust are far from minimal. Go feels minimal but it too has a lot of features compared to C and it has a garbage collector too.

Here are some things I am looking for:

* Compiles down to machine code.

* Does not have the footguns of C.

* Simple like C.

* Implementations available for all major OSes, at least, Linux, Mac, Windows, *BSDs.

After extensive search I got the feeling that it is difficult to find such a language. If I am willing to let go "simple like C", then it provides a lot of options like Rust, Nim, and all. Just asking here to see if I missed something during my search.

Re: Ask HN: Is there a simple and minimal language like C but without its footguns?

#3
Take a look at Zig (ziglang.org). Not sure it meets all of your requirements, but looks like it might. I haven't worked with it yet, but it's on my radar, as is FORTH, for the simplicity aspect you mention. And I should mention Tcl, but that's a scripting language so not what you asked for, but just in case, no, Tcl isn't 'dead', it's in most of the Cisco and other IT infrastructure equipment that's getting this website to you, it runs most of Flightaware's infrastructure, and is in all sorts of places quietly doing its job; it's how SQLite was started (as a Tcl extension, and Tcl is still a first class citizen w/r to SQLite). The creator of Redis wrote a good article on Tcl (which Redis was started in). Oops. This became a Tcl sales comment. Sorry! :)

http://antirez.com/articoli/tclmisunderstood.html

Re: Ask HN: Is there a simple and minimal language like C but without its footguns?

#5
> Does not have the footguns of C.

> Simple like C.

You have to pick one, or give in on both and find a happy medium between the two. The way you get safety in a language is by abstracting over the simplicity.

I personally would suggest biting the bullet and going with C++, you can stick to a reasonably sane subset of the language but it definitely won't be C.

Re: Ask HN: Is there a simple and minimal language like C but without its footguns?

#7
post #5

> Does not have the footguns of C. > Simple like C. You have to pick one, or give in on both and find a happy medium between the two. The way you get safety in a language is by abstracting over the simplicity. I personally would suggest biting the bullet and going with C++, you can stick to a reasonably sane subset of the language but it definitely won't be C.

> You have to pick one. The way you get safety in a language is by abstracting over the simplicity.

It should be noted that there are languages developed as safe dialects of C, such as Cyclone[1], whose design goal was to have it both ways and enhance C's safety while preserving its simplicity.

[1] https://en.wikipedia.org/wiki/Cyclone_(programming_language)

Re: Ask HN: Is there a simple and minimal language like C but without its footguns?

#8
post #2

Pascal, modula, zig? Zig sounds mostly like what you want, though: https://ziglang.org/ Possibly a subset of D could work, too: https://dlang.org/blog/2018/06/11/dasbetterc-converting-make... But likely the D language will be too big?

Nim took some inspiration from the Pascal/Modula/Oberon family, notably for its type system. It had an original goal of having a small and simple core, with a powerful macro system allowing extensions where needed, but the language core definitely grew over the years. It's still way smaller that C#/Java/C++. Might interest OP.

Re: Ask HN: Is there a simple and minimal language like C but without its footguns?

#10

GNU's GCC has added Ada and NetBSD has that in a package. Space Technology uses Ada and Forth.

I’m not sure if Ada counts as “simple” as C (maybe so, maybe not depending on where you find complexity, but I find it funny at at this point the Ada spec is smaller than the C++ spec.
Post reply on HN