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

In fairness, it'd actually be:

    (my-method my-object x y z)
But yes, the Lisp version is so much clearer to me. I just don't get why it's not more popular.


How does this work with autocomplete if you need to know the method name before the object you're working with? Maybe I'm not getting something but that sounds incredibly painful to use in practice.


In Common Lisp, it works because symbols are scoped by package, not by object. So if you're in the package foo and start typing 'bar,' then your editor would autocomplete symbols in the foo package starting with 'bar'; likewise if you typed 'baz:quux' your editor autocomplete would autocomplete symbols in the baz package starting with 'quux.'

Common Lisp most definitely doesn't have one namespace; this is really nice in practice.


OK so my confusion was from thinking Clojure is statically typed, which apparently is not true. I was basically asking the same question as https://www.reddit.com/r/Clojure/comments/6f6cq2/how_to_comp...


Because idiomatic Clojure code is based on functions and not methods.

The method call syntax is just there to support interop with Java.


or

(object-as-namespace/my-function x y z)

still fewer delimiters and less noise




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

Search: