DEV Community

Discussion on: Which mainstream programming language has the ugliest syntax?

Collapse
 
eljayadobe profile image
Eljay-Adobe

I like this game.

Ugly syntax:

  • C++
  • Perl
  • PHP
  • Intel assembly
  • Erlang
  • Eiffel

Verbose, unwieldly, and/or awkward syntax... but not what I'd quite call truly ugly:

  • Java
  • C#
  • JavaScript
  • TypeScript
  • Scala
  • BASIC
  • FORTRAN
  • COBOL
  • Objective-C

I just don't like it syntax:

  • Pascal (Object Pascal, Delphi, Oxygene)
  • SQL
  • Ruby
  • Haskell
  • LISP
  • MATLAB

Nice syntax:

  • CoffeeScript
  • C
  • Python
  • D (...basically redoes C++ syntax so it doesn't suck)
  • OCaml or F#
  • Lua
  • 6502 assembly
  • 68000 assembly
  • Prolog (... the syntax is nice; the language is painful)

Syntax that I'm not sufficiently familiar with to find the flaws, but I bet I'd find it nice, or at least not ugly:

  • Swift
  • Go
  • Kotlin
  • Groovy
  • Boo
  • Ada
Collapse
 
igormp profile image
Igor Moura

Intel's assembly syntax is really gorgeous when compared to AT&T's syntax

Collapse
 
eljayadobe profile image
Eljay-Adobe

It's not the Intel vs AT&T syntax that is the problem, it's the 80x86, Itanium and AMD64 syntax that is the problem.

I'd add that RISC syntax of DEC Alpha and PowerPC assembly is likewise ugly, but for different reasons than Intel's syntax.

Thread Thread
 
igormp profile image
Igor Moura

Ops, my bad there.

Pretty much any CISC ISA is kinda ugly when compared to most RISC ones.
MIPS, RISC-V (and even ARM to some extent) are way better to read and write, even if that means more lines of code in the end.

Thread Thread
 
eljayadobe profile image
Eljay-Adobe

I'd put 6502 or 68000 up against any RISC assembly, any day. 68000 was especially enjoyable. 6502 was small enough to hold in your head. Both were great fun. And, alas, both have utterly gone by the wayside.

Collapse
 
christopheriolo profile image
Christophe Riolo

You put OCaml in "nice syntax" and Haskell in "don't like". I've learned programming mostly with OCaml so I love it but I've been considering also learning Haskell, since I believe it is more popular. Would you say your view why you don't like Haskell? :)

Collapse
 
eljayadobe profile image
Eljay-Adobe

I find OCaml's syntax to be very, very clean, and Haskell's syntax to be unnecessary awkward and clumsy. YMMV.

Thread Thread
 
christopheriolo profile image
Christophe Riolo

Well I like the globally unambiguous (except for variants with parameters arguably) and above all unforgiving syntax of ocaml so I will surely agree :)

Thread Thread
 
mudia profile image
mudia

I am an amateur and seeking what to learn. It seems that Haskell is the holy grail of functional programming. I think OCaml only has success because it caught on in certain European Universities (especially in France).

In terms of popularity though, it seems that its reputation fro being too difficult has held it back. However, there are enough people that tell you that Scala sucks as a functional programming language. I tried starting it, and it's just ugly and tedious.

Anyway, as you are an OCaml expert maybe something like this will help you
science.raphael.poss.name/haskell-...

Thread Thread
 
eljayadobe profile image
Eljay-Adobe

Thank you for you interest.

Since you are seeking what to learn, and you are enjoying Haskell, I would say stick with Haskell.

Programming languages are tools. If Haskell can handle the kinds of problems that you are working on, then that's a good tool for the job.

If you discover a programming challenge that Haskell is not the right tool for the job, then that would be a good time to consider alternative languages.

Regardless, Haskell will teach you a lot of good programming habits. And those good habits will be applicable to any other programming language you learn in the future.

Collapse
 
eljayadobe profile image
Eljay-Adobe

I think plain OCaml and Haskell are probably about tied for popularity.

If you include F# as a kind of OCaml (since it is pretty much OCaml for .NET, as a first-class supported citizen by Microsoft), then OCaml wins the popularity contest in a landslide.

If you are deciding between Haskell versus Scala or Clojure ... well, I think either Scala or Clojure have Haskell beat.

Haskell is a pure FP.

Clojure is Lisp with FP added. (Normally targeting JVM, but can target .NET or transpile to JavaScript. Probably a bother to target .NET or JS.)

Scala is OO, with FP; targeting JVM. (In contrast to F# which is FP, with OO added in order to support .NET requirements.)

Thread Thread
 
mudia profile image
mudia

I find it fascinating that you think that Haskell uglier than OCaml! As a new hobby/amateur programmer, I find that your description of the two languages is the exact opposite. I know nothing of OCaml but just looking at comparisons of code and it seems that both languages are similar but Haskell is cleaner and has some nicer syntax options, especially when it comes to function composition.

Collapse
 
programliftoff profile image
Programming Liftoff

I think you’d put Ada under the verbose category. Definitely a lot of typing

Collapse
 
sam_ferree profile image
Sam Ferree

Wish I got to write in 6502 assembly... My OS professor made us write the machine code direct... and those 16 bit words were virtual, but the chip was designed so that the least significant byte was first... so you have to invert your variables HEX notation...

I still have nightmares.

Collapse
 
edoxtator profile image
Doc

I loved 6500 family assembler. So simple, direct.

Collapse
 
lyfolos profile image
Muhammed H. Alkan

Bad syntax: Erlang
Nice syntax: Coffeescript

... Really?

Collapse
 
eljayadobe profile image
Eljay-Adobe

What do you find particularly bad about Erlang's syntax?

Thread Thread
 
lyfolos profile image
Muhammed H. Alkan

I love Erlang already dude, that guy just says CoffeeScript is better than Erlang's syntax. That's dumb

Thread Thread
 
eljayadobe profile image
Eljay-Adobe

Oh... I didn't say Erlang had bad syntax. I said Erlang has ugly syntax.

I thought you were saying Erlang had bad syntax.

If I were targeting the Erlang VM, I'd probably use Elixir.