Does anybody else dislike paranthesis less function call in ruby?
> a = something
How do I understand 'something' is a variable or a function?

  • 0
    Wow. It treats a function with void/no parameters like a variable of whatever type it returns, containing what is returned? Idk if I like this either but mostly because I'm not used to it. Never used Ruby before.
  • 0
    As a matter of style, I avoid this in Perl (also supports this syntax), as long as a function takes no parameters. If it takes input then I don't mind missing the parentheses, but then I'm one of those nutters who likes Haskell so I may be biased...
  • 1
    I think the point is that you don't have to know if it's a function or a parameter, it's just asking for a value.
    I don't know ruby tho, I may be wrong
  • 0
    Oh, I didn't know it exists in other languages as well. I also started newly with ruby. Loved it. Agree with @wilol that, this may be the reason.
  • 0
    @willol that would be fine if you could guarantee that the function call would have no side effects, but as it stands you as someone reading the code have no idea about that without investigating. It would make more sense for a functional language of you see it that way...
  • 0
    usually you avoid having global variables in ruby, and since oop is so fun in ruby, i never actually ran into this issue
    a = class.property
    whether that's a getter function or a direct child is irrelevant in such a case
  • 0
    @Zaphod65 yup, this kind of philosophy is often native and undoable in real life :/
  • 0
    I like it. What I hate about Ruby is it's shit documentation.
Add Comment