Skip to content
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

Confusion from extend-type/extend-protocol example #55

Open
cobalamin opened this issue Jan 14, 2015 · 0 comments
Open

Confusion from extend-type/extend-protocol example #55

cobalamin opened this issue Jan 14, 2015 · 0 comments

Comments

@cobalamin
Copy link

https://github.com/swannodette/lt-cljs-tutorial/blob/master/lt-cljs-tutorial.cljs#L1335-L1355

These lines of code and comments seem to suggest that there is some sort of real difference between extend-type and extend-protocol:

;; Or you can extend a protocol on a defrecord.

I wasn't sure, so I read up on them in the docs. The docs for extend-protocol state:

Useful when you want to provide several implementations of the same
protocol all at once. [...] Expands into calls to extend-type

So am I right in assuming that extend-protocol is but a convenience macro that always expands to extend-type calls? If so, the marked lines seem a little bit odd, as we're getting nothing out of using extend-protocol instead of extend-type for a single defrecord, the syntax just seems flipped around and it left me thinking there was a fundamental difference between the two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant