Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
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.
-
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...
-
willol13898yI 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 -
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.
-
@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...
-
Qchmqs5378yusually 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
Does anybody else dislike paranthesis less function call in ruby?
> a = something
How do I understand 'something' is a variable or a function?
undefined