expr1 ...">

Why are guards called "guards"?

Does anyone know what is the source of the name for a construct called protection ?

func x
    | cond1 -> expr1  
    ...
    | condN -> exprN

The Wikipedia article Guard_ (computer_science) provides some historical perspective, but has no explanation of where the name came from (it just mentions that SASL was one of the first to use the name).

So far I have found links to Edsger Dijkstra and his Guard Command Language. Was he the first to use the term "guardian"?

+4
source share
2 answers

, , . (, Haskell "" "", ""?) .

(, ). , . 1967 " ". ( "".)

@ Ness . , "". :

case x of
  (Maybe x') | x' > 0 -> ...
  Nothing {- x' not in scope here -} -> ...

case: ; , .

https://github.com/AntC2/ghc-proposals/blob/instance-apartness-guards/proposals/0000-instance-apartness-guards.rst

0
0

Source: https://habr.com/ru/post/1679987/


All Articles