-
-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluating: defclass/std #42
Comments
It's worth noting hu.dwim.defclass-star which also offers shorter class definition macro is already included in CIEL as a dependency of fof, and nyxt browser is using https://github.com/atlas-engineer/nclasses which is their fork of hu.dwim.defclass-star. Just noting the different options, personally I haven't used CLOS much so I can't really comment on them. For advent of code and most scripts where I just need some basic data structure I'm just using defstruct, |
oooh it does indeed, thanks. It's probably not portable, but it's good for AOC.
good find. However the presence of FOF in CIEL remains uncertain (edit: fof was removed and replaced by file-finder, its little brother). Locally I discarded it, since it relies on Osicat, which complicates building and deploying CIEL. We can probably replace Osicat with another library, but that's not done yet (https://gitlab.com/ambrevar/fof/-/issues/6). I also despise defclass-star for its lack of doc/readme/example and I discarded nclasses: it's over-engineered to my taste (and to CIEL's goals), and less concise than defclass/std. ps: re osicat: Moira depends on it too, but that's been worked on last December (ruricolist/moira#1). |
Interesting info, and yea it seems you're right about
Though it seems it works fine on sbcl, ccl, lispworks. This comment from Rainer Joswig says probably every implementation besides GCL supports it. I just fired up GCL (2.6.12, the version in ubuntu repo which isn't the latest), and it's bizarre,
|
update: fof was removed and replaced by file-finder, its little brother, sans defclass-star. https://github.com/lisp-maintainers/file-finder |
I'll add a |
For an Advent of Code, I was tempted to use the terse
defstruct
, but they are a pain to use interactively (redefinitions, re-using objects), and also accessing slots programmatically was less easy: no "(slot-value object )".Anyways. defclass/std offers nice terse macros to define classes.
so we get: accessors, initargs, initforms to NIL.
and there are options to control this.
class/std
is very similar to defstruct, a difference is that it doesn't create a "example-slot1" accessor by default, it creates the "slot1" accessor, which is a good thing IMO.The text was updated successfully, but these errors were encountered: