i agree with the fast fail camp
if a value is nil but is not supposed to be, i want the program to
immediately tell me about that instead of telling me later and force me to
trace it back.

in scala, this is solved by providing 2 methods. one that gives you a
result or crashes, one that maybe gives you a result and never crashes,
depending on your use case.

2016-01-12 23:03 GMT+01:00 Gregg Reynolds <d...@mobileink.com>:

>
> On Jan 12, 2016 2:25 PM, "mattias w" <matti...@gmail.com> wrote:
> >
> > Clojure and Erlang are very similar, except for the syntax, macros and
> that you can use Java libraries.
> >
> > There is one big difference: In Erlang, fail as early as possible is the
> norm. In Clojure it is almost the opposite.
> >
> > Many errors in Clojure code will result in nil, and most operations
> accept nil as a valid parameter, i.e. many fails will not even be visible
> unless you check the result.
> >
> > The most common I stumble on is assuming that a value exists in a map,
> but that is just the top of the iceberg
>
> Not finding what you're looking for is not failure.  Nil means you have
> successfully discovered that you can't always get what you want.  There is
> no error there.
>
> Gregg
>
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to