Hacker News new | past | comments | ask | show | jobs | submit login

Ruby's syntax is beautiful once you've realized two things:

1. How blocks work, and how their minimalist syntax is beautiful. You see absolute value bars but believe me, getting used to that barebones function syntax is a gift. (No other programming language that I know of has an absolute value operator with vertical bars so it is not as hard as you think.)

2. Every time you see a dot, do NOT think attribute access. Think message sending a la Smalltalk.

Suddenly then, things like the tags.collect! line become pretty for encapsulating a callback on one line unlike the ugly function() {} crud of JavaScript, and things like defining a newtags= method become sensible, because everything including traditional attribute getting and setting reduces to message passing.




> Every time you see a dot, do NOT think attribute access. Think message sending a la Smalltalk.

Huh. You just rekindled my interest in learning Ruby. Learning Smalltalk was pretty mind-expanding.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: