Style for dotted method invocation #2622
-
Hi everyone, Are there any style guidelines for use of dots in method calls? In particular, should I prefer one of the following:
More generally, is there a Hy style guide somewhere? I would like to learn how to write beautiful Hy :-) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I prefer There used to be a style guide in the manual, but I felt that official documentation was no place for a really subjective thing like that, so I removed it. Maybe there's another one out there somewhere. |
Beta Was this translation helpful? Give feedback.
I prefer
(.method self 1)
(or with Hyrule'smeth
macro,(@method 1)
). I never liked how object-oriented languages tend to put the function second rather than first. It's a needless inconsistency with function calls. But I still call functions from modules, or class methods, with the syntax(foo.bar 1)
. In those cases, thefoo
feels more like a part of the function's name, rather than an argument of the function.There used to be a style guide in the manual, but I felt that official documentation was no place for a really subjective thing like that, so I removed it. Maybe there's another one out there somewhere.