DEV Community

Discussion on: What language has the most beautiful syntax?

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
 
jonrandy profile image
Jon Randy πŸŽ–οΈ

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

Collapse
 
rollergui profile image
Guilherme

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