On 2012-March-21, at 6:38 pm, Daniel Carrera wrote:
> The idea of smart-matching a function just doesn't quite fit with my brain. I 
> can memorize the fact that smart-matching 7 and &foo means evaluating foo(7) 
> and seeing if the value is true, but I can't say I "understand" it.

Maybe it just needs a better name.  "Match" implies that two (or more) things 
are being compared against each other, and that's how smart-matching started 
out, but it's been generalised beyond that.  The underlying .ACCEPTS method 
suggests "acceptance"... but that's too broad (a function can "accept" args 
without returning true).  "Agreement" fits, in the sense of "that [food] agrees 
with me", but I think it suggests equality a bit too strongly.  "Accordance"?  
"Conformance"?  "Validation"?  That seems a good match (ahem) for the concept: 
~~ checks whether some value is "valid" (or "desired"?) according to certain 
criteria.  The obvious way to validate some value against a simple string or 
number is to compare them; or against a pattern, to see if the value matches; 
but given a function, you check the value by passing it to the function and 
seeing whether it says yea or nay.  

I'm not sure "validation" or "validity" is the best name, but it conforms 
better to what smart-"matching" does.  Or "conformance"....  Hm.  But 
terminology that sets up the appropriate expectations is a good thing.


-David

Reply via email to