On Feb 22, 2009, at 2:48 PM, Mark Volkmann wrote:

>
> On Sun, Feb 22, 2009 at 1:40 PM, Chouser <chou...@gmail.com> wrote:
>>
>> On Sun, Feb 22, 2009 at 2:10 PM, Mark Volkmann
>> <r.mark.volkm...@gmail.com> wrote:
>>>
>>> All the documentation I've seen on validators for reference types  
>>> says
>>> they should throw an exception if the value is invalid. I've never
>>> seen it explained that they should return true if the value is  
>>> valid.
>>> That's seems to be the case though. Can someone confirm that?
>>
>> The docstrings for the reference types include this phrase:
>>
>> If the new state is unacceptable, the validate-fn should return
>> false or throw an exception.
>>
>> So it seems you are correct about the return value.
>
> Cool! So you don't have to throw an exception at all! For example, a
> validator to check that a value is an integer can be written like
> this.
>
> (defn my-validator [value] (integer? value))
>
> Actually, that means you can use predicate functions as validators, so
> my function above isn't even needed. I can just use integer? as the
> validator function.
>
>

Exactly, the enhancement is for that scenario.

Rich


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to