DEV Community

Sherry Day
Sherry Day

Posted on

What language has the most beautiful syntax?

Regardless of usability, which programming language is the most elegant?

Discussion (30)

Collapse
maxfindel profile image
Max F. Findel

I think one must mention the fabulous Brainfuck :)

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
Enter fullscreen mode Exit fullscreen mode
Collapse
abhinav1217 profile image
Abhinav Kulshreshtha

You call BrainFk, I raise you Ook!, which is based on BrainFk. ๐Ÿคฃ

Jokes aside, I really liked Shakespeare. There was something poetic about coding in it. ๐Ÿคฏ

Collapse
vulcanwm profile image
Medea

yep!

Collapse
k_penguin_sato profile image
K-Sato

Thanks! Came here to say this!

Collapse
ben profile image
Ben Halpern
1337.positive? # => true
Enter fullscreen mode Exit fullscreen mode

Is that more beautiful than 1337 > 0? I'm not sure, but that's the Ruby way to do things and it can definitely be elegant. (The typical operator syntax is also perfectly valid in Ruby).

Collapse
darkwiiplayer profile image
๐’ŠฉWii ๐Ÿ’–๐Ÿ’›๐Ÿ’š๐Ÿ’™๐Ÿ’œ๐Ÿ’๐Ÿ’Ÿ

To be honest, I think Ruby has an awful syntax. There's way too many ambiguities that get resolved in weird ways. It just feels like there once was an idea behind it that has long been forgotten.

Being able to call methods on literals is nice, but compared to the many ugly parts, I'd still prefer something a bit more unwieldy but at least consistent.

Collapse
thorstenhirsch profile image
Thorsten Hirsch

Rails is making perfect use of it. Look at such expressive queries:

recent_posts = Post.where(created_at: 2.weeks.ago..Time.now)
Enter fullscreen mode Exit fullscreen mode
Collapse
rollergui profile image
Guilherme

I have my reasons not to like Ruby, but I can't deny it's very beautiful

Collapse
jonrandy profile image
Jon Randy

Yeah, it can make code quite elegant. Totally possible to do similar in JS

Collapse
lksmrqrdt profile image
Lukas Marquardt • Edited on

Every time I work with Elixir, I feel like the code (and any generated documentation) is a work of art. It's very familiar to Ruby but has an entirely different programming paradigm, which feels great.

Also, the fact that it uses way less intransparent magic makes it more straightforward for me to read.

Collapse
etienneburdet profile image
Etienne Burdet

It's a bit more "hardcore" than Ruby too, but has much less ambiguity too. I was gonna name it too, pattern matching allows to do everyday operation so easily, once you get used to it it's crazy.

Collapse
amtins profile image
Andrรฉ

All languages that use curly brackets.

Collapse
m0nm profile image
m0nm

+1

It's more readable for me, imagine debugging indentation issues!

Collapse
k_penguin_sato profile image
K-Sato • Edited on

There is a language called "ใชใงใ—ใ“(Nadeshiko)". It's all in Japanese.

If you code and like anime, this is one way to learn Japanese lol

ๅคฉๆฐ—๏ผใ€Œๆ™ดใ‚Œใ€
ใ‚‚ใ—๏ผŒๅคฉๆฐ—ใŒใ€Œๆ™ดใ‚Œใ€ใชใ‚‰ใฐ
ใ€€ใ€€ใ€Œใƒ”ใ‚ฏใƒ‹ใƒƒใ‚ฏใธ่กŒใ“ใ†ใ€ใจ่จ€ใ†
้•ใˆใฐ
ใ€€ใ€€ใ€Œๅฎถใง่ชญๆ›ธใ—ใ‚ˆใ†ใ€ใจ่จ€ใ†
ใ“ใ“ใพใง
Enter fullscreen mode Exit fullscreen mode

I'll leave the link to their official site here.

Collapse
citizen428 profile image
Michael Kohl

To me, probably Smalltalk. Here's the classic syntax on a postcard example:

Pharo syntax on a post card

Why I like it:

  • It's extremely uniform, everything is a message send
  • the precedence rules between unary, binary and keyword messages greatly reduce the need for extra parenthesis
  • no dots between receiver and message

I also quite like Forth and other stack-based languages.

Collapse
ankush981 profile image
Ankush Thakur

Yeah, looks really tight and neat! ^.^

Collapse
tagaigy profile image
tagaigy

Definitely Smalltalk.

Collapse
jeremyf profile image
Jeremy Friesen

I love Ruby syntax, but a different take on elegance is Lisp. Everything is a list. Which is consistent and powerful. Is it "beautiful" not like Ruby but from an elegance in simplicity it holds a special spot.

Collapse
envoy_ profile image
Vedant Chainani

I Guess Solidity as it is a mix of C++, Python and JavaScript It does not has that much use case as of C++ or JavaScript but it looks Beautiful. Here is an example

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

contract MyContract {
   uint8 j = 0;
   uint public num = 2;

   function whileLoop() public returns(uint) {
      while (j < 5) {
         j++;
         num *= 2;
      }
      return num;
   }
}
Enter fullscreen mode Exit fullscreen mode
Collapse
val_baca profile image
Valentin Baca

Python's readability is unparalleled, even non-programmers can have an idea of what's going on. Straightforward but can it be called beautiful just because it's readable? English is readable but it's certainly not a "beautiful" language.

Ruby certainly emphasizes elegance. It's like poetry...but not all poetry is good.

Lisp has a timeless minimalism in its absolute lack of syntax beyond (this).

Collapse
auroratide profile image
Timothy Foster

Using LabVIEW, you can draw pictures:

LabVIEW program with wires that spell out "LABVIEW"

Collapse
saptakbhoumik profile image
SaptakBhoumik

python:D

Collapse
eljayadobe profile image
Eljay-Adobe

Tough call between APL and F# as being the most elegant. (Lispers and Schemers will disagree with me. But I make no apologies!)

Collapse
albertwoo profile image
slaveoftime

F#

Collapse
ankush981 profile image
Ankush Thakur

Yup! I'm not into the .NET ecosystem at all, but F# syntax feels perfect to me.

Collapse
sheikh_ishaan profile image
Ishaan Sheikh

Among the ones I have used, I think Python has very minimal and beautiful syntax.

Collapse
peterlitszo profile image
peterlits zo

I like Python, Rust and...... well, Haskell? (I am totally Haskell newbie, but it looks really good).

Even in JS, there is something looks pretty.

Collapse
sudocss profile image
Hamza Kalash

You should check out APL and J, and also there is Elixir which I really like!

Collapse
suess profile image
Damian

C# (version 9 and especially 10)

Collapse
ankush981 profile image
Ankush Thakur

Beauty lies in the eyes . . . and all of that, so as per me, the following languages are very pretty: Lisp (Clojure, etc.), Elm, Scala, F#, Racket, Haskell, and maybe even Julia, Ruby, Nim, D, etc.