---
title: "Guards! Guards!"
url: https://daily.dev/posts/guards-guards--tgwz4cct7
source_url: https://hauleth.dev/post/guards-guards
type: article
source: "Beam Bloggers Webring"
published: 2026-06-27T16:33:12.981Z
updated: 2026-08-24T07:04:56.511Z
tags: ["elixir"]
reading_time: 2
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Guards! Guards!

**[Beam Bloggers Webring](https://daily.dev/sources/beambloggers)** · 2 min read · 0 upvotes · 0 comments

## Summary

A subtle gotcha in Elixir guards: when a guard function like `is_map_key/2` fails (rather than returning false), it causes the entire guard expression to fail, bypassing short-circuit evaluation of subsequent `or` conditions. This means `a or b` and `b or a` in guards are not equivalent when `a` can raise an error, breaking the expected commutative property. As of Elixir 1.20.1 / OTP 29, no compiler warning is emitted for this pattern.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://hauleth.dev/post/guards-guards>

## Similar posts on daily.dev

- [On \`or\` and \`and\` operator deprecation](https://daily.dev/posts/on-or-and-and-operator-deprecation-egzxg8jhj) · Erlang Forums · 0 upvotes · 0 comments
- [Elixir v1.20.0 released](https://daily.dev/posts/elixir-v1-20-0-released-7hyajmuxu) · Elixir Forum · 1 upvotes · 0 comments

---

Tags: [#elixir](https://daily.dev/tags/elixir)

[View this post on daily.dev](https://daily.dev/posts/guards-guards--tgwz4cct7)
