PLDB
Languages Features Calendar CSV Lists Blog About Sponsor Add Language
GitHub icon

Runtime Guards

Runtime Guards

Runtime Guards are a feature.

Guards can easily be implemented using conditions (if !x: return;), but some languages include syntax and semantics specifically for guards.


Languages with Runtime Guards include Haskell, Elixir

Example from Haskell:
f x | x > 0 = 1 | otherwise = 0
Example from Elixir:
def abs(number) when number > 0, do: number def abs(number), do: -number
refinement-type-feature.html 路 runtime-guards-feature.html 路 sets-feature.html

View source

PLDB - Build the next great programming language 路 v2022 Day 29 Docs Build Acknowledgements Traffic Today Traffic Trends Mirrors GitHub feedback@pldb.com