Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Learning Elixir

You're reading from   Learning Elixir Unveil many hidden gems of programming functionally by taking the foundational steps with Elixir

Arrow left icon
Product type Paperback
Published in Jan 2016
Publisher
ISBN-13 9781785881749
Length 286 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Kenny Ballou Kenny Ballou
Author Profile Icon Kenny Ballou
Kenny Ballou
Kenneth Ballou Kenneth Ballou
Author Profile Icon Kenneth Ballou
Kenneth Ballou
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Learning Elixir
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Introducing Elixir – Thinking Functionally FREE CHAPTER 2. Elixir Basics – Foundational Steps toward Functional Programming 3. Modules and Functions – Creating Functional Building Blocks 4. Collections and Stream Processing 5. Control Flow – Occasionally You Need to Branch 6. Concurrent Programming – Using Processes to Conquer Concurrency 7. OTP – A Poor Name for a Rich Framework 8. Distributed Elixir – Taking Concurrency to the Next Node 9. Metaprogramming – Doing More with Less Index

Behaviours and protocols


Before we dive into the depths of metaprogramming, we need to discuss some related functionalities of Elixir that provide polymorphic features to the language. These are behaviours and protocols.

Briefly, behaviours provide similar functionality of interfaces from other languages such as Java and protocols provide a means for defining and dispatching function implementations for specific data structures.

Behaviours

Behaviours are not exclusive to Elixir; in fact, this is how Erlang implements the Gen* patterns. Behaviours are similar to interfaces in object-oriented (OO) languages. They specify a collection of functions that the module will expose. All the GenServer modules will have the handle_call, handle_cast, and handle_info functions.

Note

The spelling of behaviour in the core Elixir and Erlang API uses the British English spelling. However, Elixir's parser will allow either spelling.

Similar to interfaces in OO languages, the behaviour definition also helps the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images