Hacker News new | ask | show | jobs
by TurboHaskal 1297 days ago
Ok, I will try to use Common Lisp without the CLOS:

  * 123
  123
That looks good, let's see...

  * (describe *)
  123
    [fixnum]
Huh? What's a FIXNUM?

  * (describe 'fixnum)
  COMMON-LISP:FIXNUM
    [symbol]

  FIXNUM names the built-in-class #<BUILT-IN-CLASS COMMON-LISP:FIXNUM>:
    Class precedence-list: FIXNUM, INTEGER, RATIONAL, REAL, NUMBER, T
    Direct superclasses: INTEGER
    No subclasses.
    Sealed.
    No direct slots.
Uh-oh.

Anyway, you see what I mean now by not being able to use Common Lisp without the CLOS. Unless by using the CLOS you mean having to explicitly opt-in by using classes, multiple dispatch, multiple inheritance, generic functions, the MOP and all that weird stuff.

1 comments

> Unless by using the CLOS you mean having to explicitly opt-in by using classes, multiple dispatch, multiple inheritance, generic functions, the MOP and all that weird stuff.

Yes, that's what I meant. The fact that the CL type system maps into the class system doesn't mean we all code OOP. If you want to argue semantics, sure..

SBCL will generate _very_ different code for fixnums vs general objects, so much so that claiming that (+ 1 2) is using CLOS makes no sense.

It makes sense to me. The same as claiming that doing `1 + 2` in OCaml is making use of the type system despite me not writing any type information and the language performing type erasure.