On Apr 8, 2017 3:47 PM, "Gregg Reynolds" <d...@mobileink.com> wrote:



On Apr 7, 2017 9:57 PM, "Didier" <didi...@gmail.com> wrote:

 | I think you missed my point, which is only "Spec is great as we have the
power of Clojure" - sure, just don't forget you have the power of ANOther
language in that language as well.

Hum, I've probably missed your point sorry, I'm still not following.

 | no, this will, or at least should, be caught. 10/0 is not an int, and
typed "/' would reject 0 as an ill-typed denominator.

In most static type systems this will not be caught, because they don't
have a fraction type.


"most" -ok.  that's empirical, eww!

So this is actually a function that takes two number types, and 0 is a
number too, so it will type check, but throw an exception at runtime.


maybe my mind has been twisted by dependent types. imho a definition of
"div" that accepts 0 as denominator is a bad defn, or at least a non-typed
defn.  "10/0" is ill-typed. this is obvious mathematically, right? division
by zero is undefined.  it's not really a question of "fraction types"; just
rewrite as (div 10 0).  you do not need a fraction type to define "/". what
you need is a type that does not include zero.


i would add that if you want real static typing you're almost forced to
support dependent types. unless you want a defn of static typing that
includes a great big "well, except for..  " clause.  like a fn that is only
defined for 0..9.


g

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