OTOH, when Rich gave a talk at MIT recently he mentioned he wasn't terribly interested in type systems for Clojure apart from (potentially) a simple binary type system to distinguish I/O-side-effecty things from non-I/O-side-effecty things. He also mentioned something extremely interesting about wanting to make Clojure amenable to analysis by external static correctness checking tools, rather than build types and type-checking into the language itself.
I should let him characterize his views himself, though, because I imagine I'm getting it at least part wrong. Either way, Ajay, Clojure is a dynamic and dynamically typed system. Cons: No compile-time type checking, more runtime bug-catching. Pros: Easy, module-by-module, REPL-based interactive development, expressiveness, somewhat easier code reuse, faster development, and easier interaction with external systems that may change under your nose. I was born and bred in QBasic, Perl, and later Ruby, so this is what feels most natural to me. On Tue, Dec 15, 2009 at 8:43 AM, Laurent PETIT <laurent.pe...@gmail.com>wrote: > > > 2009/12/15 ajay gopalakrishnan <ajgop...@gmail.com> > > Oh ... I know all that. What I wanted to know is that is there any way to >> FORCE compile time checking by providing some flag or the other to Clojure >> compiler. If not, I guess a good set of test cases is the only way to fix >> it. (Good test cases are always recommended, it's just that in this case it >> becomes unavoidable) >> > > Not yet, and - just guessing - neither in a short nor middle term. > > But I remember Rich mentioning being interested in type systems "a la" Qi > language ( > http://en.wikipedia.org/wiki/Qi_(programming_language)<http://en.wikipedia.org/wiki/Qi_%28programming_language%29>). > This allows to enable/disable type checking, but maybe what seemed more > interesting was the way to define the type via sequent calculus ( > http://en.wikipedia.org/wiki/Qi_(programming_language)#Type_Checking<http://en.wikipedia.org/wiki/Qi_%28programming_language%29#Type_Checking>). > > HTH, > > -- > Laurent > > >> >> Ajay >> >> >> On Tue, Dec 15, 2009 at 7:23 AM, Baishampayan Ghose <b.gh...@ocricket.com >> > wrote: >> >>> Ajay, >>> >>> > It tried the following in REPL and got no error. Personally, I feel >>> that >>> > I should get an error because calling square on strings is wrong in >>> both >>> > cases. >>> > >>> > Is there a way out of this in Clojure? >>> > >>> > |(defn square[n] (* n n)) >>> > >>> > (if (= 0 0) (println"hello") (map square["a" "b"])) >>> > >>> >>> What did you expect from Clojure? In the above form the `map` is a part >>> of the else form and that's why it's not executed. >>> >>> If you don't know already, the syntax for `if` in Clojure is like this - >>> >>> (if expression >>> (then form) >>> (else form)) >>> >>> If you have multiple then or else forms, you can wrap them inside a `do` >>> form like this - >>> >>> (if expression >>> (do >>> (then form) >>> (more then form)) >>> (else form)) >>> >>> > The following gives error (because it gets evaluated): >>> > >>> > |(defn square[n] (* n n)) >>> > >>> > (if (= 0 1) (println"hello") (map square["a" "b"])) >>> >>> In the above form, the map is a part of the else form and since 1 is not >>> equal to 0, the `map` is executed. >>> >>> I hope your confusion is cleared. >>> >>> PS - If you are worried about "compile time type checking", I think it's >>> prudent to mention now that Clojure is a dynamically typed programming >>> language where types are checked at run-time and not compile time. >>> >>> Regards, >>> BG >>> >>> -- >>> Baishampayan Ghose <b.gh...@ocricket.com> >>> oCricket.com >>> >>> -- >>> 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<clojure%2bunsubscr...@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 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<clojure%2bunsubscr...@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 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<clojure%2bunsubscr...@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 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