From 43585d5617f40b3f77092e9a0e59786be2730648 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Mon, 5 Jun 2023 17:11:32 -0400 Subject: [PATCH] docs: explain `nil` handling in expressions better --- documentation/topics/expressions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/topics/expressions.md b/documentation/topics/expressions.md index 82778888..15afb17b 100644 --- a/documentation/topics/expressions.md +++ b/documentation/topics/expressions.md @@ -8,7 +8,7 @@ Ash.Query.expr(x + y) Ash.Query.expr(post.title <> " | " <> post.subtitle) ``` -Ash expressions have some interesting properties in their evaluation, primarily because they are made to be portable, i.e executable in some data layer (like SQL) or executable in Elixir. In general, these expressions will behave the same way they do in Elixir. The primary difference is how `nil` values work. They behave the way that `NULL` values behave in SQL. This is primarily because this pattern is easier to replicate to various popular data layers, and is generally safer when using expressions for things like authentication. The practical implications of this are that `nil` values will "poison" many expressions, and cause them to return `nil`. For example, `x + nil` would always evaluate to `nil`. +Ash expressions have some interesting properties in their evaluation, primarily because they are made to be portable, i.e executable in some data layer (like SQL) or executable in Elixir. In general, these expressions will behave the same way they do in Elixir. The primary difference is how `nil` values work. They behave the way that `NULL` values behave in SQL. This is primarily because this pattern is easier to replicate to various popular data layers, and is generally safer when using expressions for things like authentication. The practical implications of this are that `nil` values will "poison" many expressions, and cause them to return `nil`. For example, `x + nil` would always evaluate to `nil`. Additionally, `true and nil` will always result in `nil`, *this is also true with or and not*, i.e `true or nil` will return `nil`, and `not nil` will return `nil`. ## Operators