▲ | uvas_pasas_per 6 days ago | ||||||||||||||||||||||||||||
Lisp is very cool. But one thing I do not like is that the syntax style `(fun a b c)` loses out to the less-symmetric "OO" style `a.fun(b, c)` when it comes to IDE auto-completion. And for me the IDE help is important to provide a smooth developer experience and minimize wasted brain energy. I'd like to find a way to make the editing and auto-completion work better. I think the way IDEs (and maybe our brains) work is: "here is a thing X, now what can I do to/with it?". That translates to typing in your editor: "X.[cursor here]", and then the IDE lets you see and search the things you can "do" with X. But if, in Lisp, you write "([cursor here]", you are immediately confronted with: "what is the signature of that function again?", but the IDE has nothing to go on. Maybe there is different style of editing, where we could type the arguments, and then trigger the auto-complete. | |||||||||||||||||||||||||||||
▲ | lenkite 6 days ago | parent | next [-] | ||||||||||||||||||||||||||||
In Clojure, this is merely (a/fun b c) or (. a fun b c) depending on whether a is a namespace or an object. Autocomplete works wonderfully. I would strongly urge you to try a coding session using Cursive so you can objectively refactor your obsolete LISP opinions. | |||||||||||||||||||||||||||||
▲ | bcrosby95 6 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||
I don't know about other lisps, but Clojure has namespaces and that's good enough for me. So you can type "(foobar/" and get a list of functions in the foobar namespace. | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
▲ | kqr 6 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||
Haskell sort of has this. You type (_ a b c) and the compiler tells you which methods would make sense there based on all three variables (so in a sense it is even more useful.) | |||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||
▲ | thegeekpirate 6 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||
Odin's language server calls it "fake methods". | |||||||||||||||||||||||||||||
▲ | everforward 5 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||
I think this is more familiarity bias and the presence of an enforced type system than a necessity of auto-complete. In the same way that `a.` auto-completes to methods of `a`, `(fun ` could auto-complete to a list of in-scope variables that satisfy `fun`'s type signature. A lot of lisp is untyped though, even in variants that have support for it. I also think there's some familiarity bias to the OO style. I don't find it particularly natural, though that's subjective. I often know what I want to do, and have to find the object that has the method. E.g. I know I want to read a particular header, but is it on Request, or on Request.Headers, or are headers passed in as a separate object? It feels cleaner to do something like `(get-header "SOME-HEADER" ` and have the IDE tell me I need to pass in `(get 'headers request)` or similar. | |||||||||||||||||||||||||||||
▲ | tmtvl 6 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||
What do you do if 'a.<tab>' doesn't work because it's not 'a.fun(b, c)' but 'b.fun(a, c)' or 'c.fun(a, b)'? Also think of autocompletion for 'var x = new' to 'var x = new ByteArenaFactory()', the way you get from nothing to 'ByteArenaFactory' is the same way you get from nothing to '(fun a b c)'. | |||||||||||||||||||||||||||||
▲ | xigoi 6 days ago | parent | prev [-] | ||||||||||||||||||||||||||||
Janet, like some other lisps, has the arrow macro, which allows you to write in the “OO” style.
| |||||||||||||||||||||||||||||
|