Ancestors

Toot

Written by lhp on 2024-09-10 at 15:46

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

Descendants

Written by Stefano Rodighiero on 2024-09-10 at 15:57

@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

Written by Isaac Freund on 2024-09-10 at 21:03

@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

Written by Isaac Freund on 2024-09-10 at 21:09

@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

Written by vindarel on 2024-09-11 at 10:16

@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

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113114035993288185
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
273.546332 milliseconds
Gemini-to-HTML Time
1.131785 milliseconds

This content has been proxied by September (ba2dc).