Template:Define Really

From Erights

Revision as of 22:27, 25 March 2009 by Kevin Reid (Talk)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Use this template to get a definition of this guard for use in E spec tests. XXX Remove this when Really or some equivalent gets into ELib.

? /** Coercion-inhibiting guard wrapper. For example, Really[ConstList] will accept only ConstLists and not things which coerce to them. */
> def Really {
>   to get(guard) {
>     return def reallyGuard {
>       to coerce(specimen, optEjector) {
>         def coerced := guard.coerce(specimen, optEjector)
>         if (coerced != specimen) {
>           throw.eject(optEjector, E.toQuote(coerced) + " must be same as original specimen " + E.toQuote(specimen))
>         }
>         return coerced
>       }
>     }
>   }
> }; null
Personal tools
more tools