> Given that the examples you provided are from typed languages and Clojure 
> isn’t typed, what would satisfy you here?
>


Well... static types have absolutely nothing to do with errors handling 
mechanics. That's just a way for your compiler to check if you glue all 
pieces together in a reasonable way during compilation. That's it. Golang 
is a good example as it doesn't use types to declare good or bad results. 
It uses 2 return values (result, nil) or (nil, error). And one more 
interesting observation here: even tho' you don't need a "special" error 
type as you're free to put anything there (at the end of the day that's 
just a convention you can ignore), Golang still provides standard errors.* 
package to deal with errors represented as data.

We don't have tuples or static types in Clojure but we have protocols, 
deftype, vectors & keywords, maps & keywords. We can also go further and 
implement that in Java if we care about low-level performance and/or 
interoperability. I think that protocol is a really good approach here as 
it empowers you with a really fine-grained control of what you treat as an 
error value still keeping that composable with different abstractions. 

First off, a nitpick: Clojure doesn’t have a standard library. 
>

That's' pretty irrelevant for this particular conversation, but I still 
think that such a juggling with terms is unnecessary speculative. If I 
wrote `(map str (range 5))`, I assume `map`, `str` and `range` are defined 
somewhere in a way I don't need to plug-in an external library to make this 
happen. You can call this "core", "stdlib", "standard library" or whatever. 
It doesn't change the essence of the problem I've described. 

there are a few ways to deal with this
>

If I got your message correctly, what you're suggesting is actually NOT TO 
USE exceptions with core.async. Which is true. As I stated in my first 
message, core.async is a great example of the context where exceptions 
don't work. And I personally don't see any way to make them work. But if we 
promote exceptions as an official way/best practice and don't anything 
else, then you have to expect most of your code and most of the libraries 
you're using to throw something here and there. It's not that simple to 
protect yourself from exceptions, unfortunately. Going further. If we 
choose not to use exception... we're right here, in the no men land where 
no rules are defined and everyone on their own. Which right what I was 
talking about. 
  

-- 
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