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

It's not self.call(:my_method) --- that's nuts. It's my_method[param1, param2] which is aliased to my_method.call(param1, param2). Ruby's syntax can be a crapfest (like Procs not being callable without [] instead of () for example), but this isn't an example.



proc[arg1,arg2] is terrible; strictly worse than proc.call arg1, arg2. When I see an id followed by brackets, I'm looking at a collection, not a callable. This is only exacerbated by Ruby's weird/useful [index,length] convention.


I think what we both want is proc(arg1, arg2).


In newer versions of Ruby you can do proc.(arg1, arg2), which I think is a decent compromise.


Wow, I actually never knew that it was [index, length]. I usually just pass a range as the key when I'm doing stuff like that, so you can do "hello"[2..3] (2 <= i <= 3) or "hello"[2...3] (2 <= i < 3).




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

Search: