6.20. kink/REF¶
6.20.1. type ref¶
`ref` is an abstract type which can store and load a value.
6.20.1.1. Ref.load¶
`load` returns the current value which `Ref` contains.
`load` must not raise an exception.
6.20.1.2. Ref <- New_val¶
`<-` operator, or `op_store` method, sets `New_val` as the new value of `Ref`.
`<-` operator may raise an exception when preconditions for `Ref` and `New_val` are not met. For example, if `Ref` accepts only `str` values, but `New_val` is an `num`, `<-` operator may raise an exception.
`<-` operator may adjust `New_val` to an acceptable value. For example, if `New_val` is a `num` value 1000, but `Ref` accepts `num` values from 0 to 99, `<-` operator may set 99 as the new value.
6.20.2. REF.is?(Val)¶
`is?` returns whether `Val` is a `ref` value.