On 11 April 2011 08:31, Ken Wesson <kwess...@gmail.com> wrote:
>> So your not-int-in-range? function is a compound function, made up of
>> four simple functions.
>
> So? This whole discussion arose because some of them have
> preconditions, like at-least 1 not making sense for blank or
> non-integer input.

Yes, but remember that I said I was looking for non-compound
solutions. In my view, simple functions are more idiomatic Clojure.

> Is there anything that indicates they're more secure?

I'd argue that encouraging people to think of what to allow is better
than encouraging people to think of what to deny.

You could also programmatically ensure that keys are invalid by default.

> If people are having a problem with the existing way, it's useful to
> suggest alternative ways of looking at the problem. Here, for
> instance, there was some difficulty regarding preconditions, and
> generating the right error message when more than one thing failed
> (e.g. it wasn't in the range 1 to 120 because it wasn't an integer at
> all).
>
> I just thought it might be helpful to look at things from another
> direction. Now we can all look at things from *both* directions.

Sure, and I'm not saying there aren't clear advantages to having
inverted validations.

It's because your idea has merit that I'm taking the opposite side and
arguing against it. If it turned out that I came to believe that the
advantages to this approach outweighed any disadvantages, I'd
whole-heartedly adopt the idea. For that reason, my current approach
requires a vigorous defence.

I'm certainly not saying you shouldn't have brought the idea up in the
first place! I agree that it's useful to look at this problem from as
many different angles as we can.

- James

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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