DEV Community

Cover image for How Would You Create the Perfect Coding Language?

How Would You Create the Perfect Coding Language?

dev.to staff on May 13, 2023

Imagine you have the chance to create a coding language from scratch. What unique features or capabilities would you introduce, and how would it im...
Collapse
 
siddharthshyniben profile image
Siddharth

There isn't a "perfect" programming language, really. It all depends on user preferences. Some people like OOP. Some people like FP. Some people like Java purely because there's no async to deal with

IMO, the most powerful programming language would be Lisp. I don't think there's much to improve there, other than better developer tools, faster compilers, etc.

Collapse
 
mellen profile image
Matt Ellen-Tsivintzeli

This is why the answer I didn't write was "kill everyone else so they can't tell me my language isn't perfect" ;)

Collapse
 
mellen profile image
Matt Ellen-Tsivintzeli

I'd really like to try my hand at inventing a language, if only I had the time!

I'd probably make something like Erlang: a functional language optimised for parallel programming.

  • I'd want to make it as deterministic as possible, so it could be "easy" to make real time systems.
  • I'd want it to run efficiently so that it would be suitable for low power systems.
  • I'd give it really good documentation, so getting started didn't seem like an insurmountable task.
Collapse
 
citronbrick profile image
CitronBrick

Here's my recipe for the perfect language.

  1. Ruby syntax.
  2. Use curly braces or colon (Python like) blocks, instead of the end keyword.
  3. Make it camelCased instead of snake_case.
  4. Give it a well-presented official documentation (like MDN or JavaDoc (docs.oracle.com/en/java/javase/17/...)
Collapse
 
janmpeterka profile image
Jan Peterka
  1. Agree, great starting point!
  2. I don't like end much, but I don't like curly braces better. colon is okayish, but requires indentation to signal structure. which has its pros, but takes from flexibility. Ruby also offers some ways to get around end - inline colon braces calls, end-less method definitions. Maybe there could be some more changes made - else ending if statements automatically comes to mind. But, explicit end of blocks allows to follow on that block, which is also a cool trick, so maybe it would be a loss to not have that.
  3. well, you can use both, it's just preference (okay, when using classes from base library, you can't, but I would guess there will be some smart way to "alias" them all.
  4. yes please!
Collapse
 
auroratide profile image
Timothy Foster • Edited

I suppose in the realm of "perfection" I'm allowed to dream a little ( :

How about just using a language like Lojban? It's a constructed spoken language meant to produce unambiguous sentences.

Spin up a sufficiently powerful language model, collaboratively exchange sentences, and instead of code it gives you an executable. In other words, CompileGPT ^^

Collapse
 
lizmat profile image
Elizabeth Mattijsen

I think I'd take a lot of inspiration from the Raku Programming Language, and take out quite a few of the historical warts.

Collapse
 
peter-fencer profile image
Peter Vivo

A few times I created a imperfect coding language - it is 2 small script language for flash action script ( around - 2000 - macromedia times ). The first one is able to make a longer scripted animation where I can manage a animated tutorial for kids.

Other one is for Narnia Collectible Card Game program, to manage card special skill and whole game play, script language called: slash, and very specialized to card game play. Main favorite was: I don't need to rerun the program every time when I would like to develop something new, just enough to type a script in a console interface. So it is really speed up the whole development process.

But these specialized small script language is lead me to understand a different declarative programming solution in different languages. So that why think the Rust macro rules is a great platform to create some "language".

Collapse
 
agardnerit profile image
Adam Gardner

I was thinking about this yesterday. How about thinking about security when building the language? Both by blocking "legacy" issues (buffer / heap overflows, use after free, malloc etc. etc.) but also when one of these is attempted, an alert is fired?

Your language actually becomes a security product at runtime.

Collapse
 
webbureaucrat profile image
webbureaucrat • Edited

I think I'd just invent Idris with C-like delimiters instead of whitespace delimitation. At any rate I would definitely not support throwing runtime exceptions.

Collapse
 
jrolingdev profile image
jrolingdev

Rust if it had Go’s compiler speed, std library and a green thread/coroutine implementation in the std library and it also didn’t introduce so many new features so quickly.