Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What an odd question lol. Yes, people like writing in Ruby. I’m one of the. Switched from C# in 2016.


You don't miss things like enums, exhaustive switch or any other basic language features? How about `method_missing` its such a crazy idea to me that something like this exists, I know why it exists but I am like why, why such bloat and complexity.


Ruby inheritance is a list of class names. When you call a function on an object, Ruby goes up that list, looking for the first one that defines that function.

If it doesn't find any class defining that function, it calls `method_missing` (and again, goes up the list). The Ruby base object class defines `method_missing`, so if no-other classes in the ineritance list do, you get that one (which then throws the usual error).

IMO, there is zero bloat or complexity added by this; it's super simple language bootstrapping (allowing more of Ruby to be written in Ruby, vs the c interpreter).

What do you see as the bloat and complexity added by this?


No, I honestly don’t. I can emulate an Enum without having an Enum type. I rely less on a compiler and more on myself with automated tests.


  >  rely less on a compiler and more on myself with automated tests
jme, but i think this is a muscle that a lot of people don't have developed if they came from a language/toolset/ide that does automatic type checking and autocomplete reliably etc


Part of the problem is when you have to rely on someone else.


Can you elaborate on why you think method_missing is bloat?


As another commenter said,

> it’s about your taste and philosophy.

Personally, method_missing goes against both of mine. It makes programs harder to reason about, more difficult to debug, and nearly impossible to `grep`. That said, I understand that this kind of flexibility is what some people like. I just don’t.




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

Search: