fasterthanlime / shin

:warning: (def shin (dissoc clojurescript :jvm :google_closure)) (deprecated)
MIT License
35 stars 1 forks source link

defprotocol, deftype, reify, satisfies? #9

Closed fasterthanlime closed 9 years ago

fasterthanlime commented 9 years ago

Mainly, at the start, for stuff like IAtom, ICollection, ISeqable, etc.

Now in the stdlib they behave as if we had interfaces, but there's no way to check like satisfies? and stuff. That would be extra super useful.

fasterthanlime commented 9 years ago

If anyone has an idea of the difference between satisfies? and extends?, I'm all ears.

kuon commented 9 years ago

In ruby?

fasterthanlime commented 9 years ago

@kuon No, silly :) In Clojure.

Compare and contrast:

fasterthanlime commented 9 years ago

Maybe satisfies? is for instances and satisfies? is for types?

kuon commented 9 years ago

After reading a bit, it seems extends? is for type and satisfies? is for object.

Extends:

https://github.com/clojure/clojure/blob/clojure-1.6.0/src/clj/clojure/core_deftype.clj#L517

Satisfies:

https://github.com/clojure/clojure/blob/clojure-1.6.0/src/clj/clojure/core_deftype.clj#L530

fasterthanlime commented 9 years ago

Forgot to tag f99be8cdb009d8cb206f5bc5e9f852a5538ca666 in this issue.

fasterthanlime commented 9 years ago

Ah, it appears ClojureScript does not have extends?. Eh.

fasterthanlime commented 9 years ago

This issue was too wide, exploded into #101, #102, #103 and closing this one.