From 5e2c805319c39d40f7ec209076a6e0d19c000408 Mon Sep 17 00:00:00 2001 From: nnullcolumn <264514568+nnullcolumn@users.noreply.github.com> Date: Sat, 11 Jul 2026 22:54:48 -0500 Subject: [PATCH 1/3] init --- docs/builtin-type-aliases-truthy-falsy | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 docs/builtin-type-aliases-truthy-falsy diff --git a/docs/builtin-type-aliases-truthy-falsy b/docs/builtin-type-aliases-truthy-falsy new file mode 100644 index 00000000..6fc93424 --- /dev/null +++ b/docs/builtin-type-aliases-truthy-falsy @@ -0,0 +1,23 @@ +# Builtin Truthy & Falsy Type Aliases + +## Summary + +add built-in type aliases `truthy` and `falsy` and update analysis stringification for these representations + +## Motivation + +its very inconvenient to type `~(false?)` (truthy) / `false?` (falsy) + +currently this requires type functions but im going to larp negation syntax existing for the sake of this rfc + +## Design + +see [Summary](#Summary). + +## Drawbacks + +- no drawbacks + +## Alternatives + +- do nothing. this would make many people very sad, see [2516](https://github.com/luau-lang/luau/issues/2516) From 55a4ae78349d502c1e04c7454987e7747f1e091a Mon Sep 17 00:00:00 2001 From: nnullcolumn <264514568+nnullcolumn@users.noreply.github.com> Date: Sun, 12 Jul 2026 03:56:50 +0000 Subject: [PATCH 2/3] i'm so intelligent --- ...-aliases-truthy-falsy => builtin-type-aliases-truthy-falsy.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/{builtin-type-aliases-truthy-falsy => builtin-type-aliases-truthy-falsy.md} (100%) diff --git a/docs/builtin-type-aliases-truthy-falsy b/docs/builtin-type-aliases-truthy-falsy.md similarity index 100% rename from docs/builtin-type-aliases-truthy-falsy rename to docs/builtin-type-aliases-truthy-falsy.md From e19cfe56f3dcf7449e6b8ec6fb98e3f89198330f Mon Sep 17 00:00:00 2001 From: nnullcolumn <264514568+nnullcolumn@users.noreply.github.com> Date: Wed, 15 Jul 2026 15:05:59 -0500 Subject: [PATCH 3/3] improve rfc --- docs/builtin-type-aliases-truthy-falsy.md | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/builtin-type-aliases-truthy-falsy.md b/docs/builtin-type-aliases-truthy-falsy.md index 6fc93424..3c1d1926 100644 --- a/docs/builtin-type-aliases-truthy-falsy.md +++ b/docs/builtin-type-aliases-truthy-falsy.md @@ -1,23 +1,28 @@ -# Builtin Truthy & Falsy Type Aliases +# Builtin Truthy & Falsey Type Aliases ## Summary -add built-in type aliases `truthy` and `falsy` and update analysis stringification for these representations +Introduce two built-in type aliases for `truthy` and `falsey` representing the truthiness in boolean-like or ternary operators (`if`, `and`, `or`, `not`, etc.) ## Motivation -its very inconvenient to type `~(false?)` (truthy) / `false?` (falsy) - -currently this requires type functions but im going to larp negation syntax existing for the sake of this rfc +Truthiness and falsiness is important for understanding control flow in conditional operations. Currently, the types representing truthy/falsey values are fairly obtuse (`~(false?)`, `false?`, or more verbosely `~(false | nil)` / `false | nil`). We can make these types easier for users to reason about, as well as easier to read and write. ## Design -see [Summary](#Summary). +This RFC proposes adding two built-in type aliases as definitions: + +```luau +type truthy = ~(false | nil) +type falsey = false | nil +``` ## Drawbacks -- no drawbacks +These new aliases may conflict with existing type names in user code, and they may also introduce some confusion for users who are not familiar with the concept of truthiness or falsiness. ## Alternatives -- do nothing. this would make many people very sad, see [2516](https://github.com/luau-lang/luau/issues/2516) +- do nothing. this would keep the language's built-in type aliases more minimal (only what's necessary), which makes the experience easier for new users. I personally believe the convenience and relatively common knowledge about truthiness and falsiness of values will outweigh the simplicity of not doing this. +- `falsy` instead of `falsey`. There's nothing wrong with this, but it has a different column width from `truthy` +- introduce `types.falsey` and `types.truthy` in the type function runtime. This can be discussed separately, since it is not exclusive with this RFC.