-
Notifications
You must be signed in to change notification settings - Fork 57
Remove defunct +hard and ;; rune #1055
Comments
On second thought, the
would become
|
This sounds like a good move. /cc @pilfer-pandex, this seems like it would be immediately useful. |
Honestly, I think it would be great if you had to use a different rune to normalize a value to a type. This would allow us subsequently to separate out the notion of type from the notion of normalizing gate. |
@belisarius222 given the proposed new semantics for |
imo having those notions forcefully entwined to reduce conceptual surface area is one of the like top 10 useful hoon design decisions. (The removal of molds proper strains, but does not break it.) |
These expressions are now both wrong, since they check for mold idempotence, i.e. they call the mold function on a piece of data to coerce it to the desired type, then check whether the coerced value equals the original value.
This made sense back when molds were supposed to always produce a value of the correct type; however, now a mold is supposed to crash if given an invalid piece of data, and it is not required to produce an identical noun to its input; in fact, each type can declare a normalizer function that can be used to migrate old data to new, or to canonicalize data.
Now that a valid noun can be modified during coercion, checking for equality will lead to false negatives for type validation -- not to mention incurring the extra runtime cost of the equality check.
These expressions are now technically invalid (although they will work for now, since the type does not have a custom validator function):
They should be replaced with this:
The
;;
rune should be removed, and the+hard
function should also be removed (we still need+soft
, which now virtualizes the call to the mold gate to catch a crash, for error handling).The text was updated successfully, but these errors were encountered: