I am curious: Is there any #lisp with syntax sugar for methods?
Like (object.method argument) instead of (method-for-object object argument)?
I like mixing in a tiny amount of OOP via GOOPS once in a while, but it's usually pretty verbose.
=> More informations about this toot | More toots from lhp@mastodon.social
@lhp what you describe would be more profound than just syntactic sugar. (f obj1 obj2) performs --at least in Common Lisp, and I think also in Guile with GOOPS-- multi-dispatch, meaning that the actual method to run is chosen by examining the type of both obj1 and obj2. There is not a single message receiver, as it happens in languages with single-dispatch (Python, Smalltalk, etc)
=> More informations about this toot | More toots from eslr@mastodon.social
@lhp fennel is a strange lisp as it is more or less an alternative syntax for lua and compiled to lua. It has lua-style (foo:bar a b c)
method call syntax: https://fennel-lang.org/reference#-method-call
=> More informations about this toot | More toots from ifreund@hachyderm.io
@lhp Looks like Janet has method call sugar of a slightly different variety: https://janet-lang.org/docs/object_oriented.html
we could replace the method call(:honk Car)
with((get Car :honk) Car)
, and this is exactly what the runtime does when it sees a keyword called as a function.
=> More informations about this toot | More toots from ifreund@hachyderm.io
@lhp In CL methods are not tied to objects/classes though, so it can just be (method obj1 obj2).
We don't need object.method because method
can be generic, and have an implementation for any built-in type.
There's some adaptation when coming from another OO system, but in CLOS we effectively manipulate more generic vocabulary than object.method.
That being said, one can use package prefixes for encapsulation.
=> More informations about this toot | More toots from vindarel@framapiaf.org This content has been proxied by September (ba2dc).Proxy Information
text/gemini