Skip to Main Content
Programming Clojure, 3rd Edition
book

Programming Clojure, 3rd Edition

by Alex Miller, Stuart Halloway, Aaron Bedra
February 2018
Intermediate to advanced content levelIntermediate to advanced
304 pages
7h 11m
English
Pragmatic Bookshelf
Content preview from Programming Clojure, 3rd Edition

Protocols

One piece of Clojure’s solution to the expression problem is the protocol. Protocols provide a flexible mechanism for abstraction that leverages the best parts of interfaces by providing only specification, not implementation, and by letting datatypes implement multiple protocols. Additionally, protocols address the key weaknesses of interfaces by allowing nonintrusive extension of existing types to support new protocols.

Following are the strengths of protocols:

  • Datatypes can implement multiple protocols.

  • Protocols provide only specification, not implementation, which allows implementation of multiple interfaces without the problems associated with multiple-class inheritance.

  • Existing datatypes can be extended to implement ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Programming Kotlin

Programming Kotlin

Venkat Subramaniam
Getting Clojure

Getting Clojure

Russ Olsen

Publisher Resources

ISBN: 9781680505719Errata Page