Old McCarthy Had a Form
atomized.org
atomized.org
Does this mean that when you instantiate a class you get an "object" with only "slots". To interact with such objects there needs to be a way to read and write slot-values. Does that mean there is no way to prevent anybody from writing and reading any slot of any object?
I know that in JavaScript ES6 you can define symbols that are private to the module which defines them which can effectively encapsulate data inside object-instances. That works best with an ES6 classes which have methods which are public but which can then access the data via those module-private symbols.
Yes, usually you define accessors/readers for the slots that you want to be available to others. An accessor is basically a function that can be used like a variable, but allows arbitrary code to run when getting/setting it (this is important to allow macros to be written without having to constantly worry about whether something is a function call or a variable). The `defclass` macro has an option to automatically generate accessors, readers or writers for the simple case (just directly reading/writing the slot), but you can also define more complex ones by hand.
You could of course also export the symbol to allow direct access to the slot, but accessors are the typical choice.
[0] https://www.gnu.org/software/emacs/manual/html_mono/eieio.ht...
[1] To be clear, I've used CL only briefly. I'm only aware of emacs lisp by reputation. I don't doubt that experienced lispers are comfortable structuring their information as lists of lists and atoms.
I'm a very experienced Common Lisper and I very rarely use lists of lists except for small, incidental purposes. The Common Lisp Object System (as well as defstruct, arrays, hash tables, etc.) exists because lists -- while quite flexible -- are an extremely poor data structure for anything complicated because they make code almost impossible to understand and maintain. Using lists for everything is considered very poor Lisp programming practice -- at least by me.