Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I see now that Racket has types. At first glance it seems to be almost identical to Haskell typing. But is Lisp's CLOS covering some of the space Haskell types cover? Creating a very strict Haskell type and an object in any OO language seems vaguely similar. It's just that I've drunk some of the Haskell kool-aid and I'm totally paranoid that if I go down the Lisp road, I'll be screwed due to dynamic typing.

share|improve this question
add comment

1 Answer

CL type system is more powerful than the Haskell one, e.g., you can have a type (or (integer 1 10) (integer 20 30)) for a value 1,2,...9,10,20,21,...,20.

However, the compiler does not force its understanding of type safety down your throat, so you can ignore its "notes" - at your own risk.

This means that you can write Haskell in Lisp (so to speak) by declaring all types and carefully making sure that all the necessary types are inferred, but then it is easier to use Haskell in the first place.

Basically, if you want strict static typing, use Haskell or OCaml, if you want dynamic typing, use Lisp. Each path has its advantages (and zealots) and disadvantages (and detractors), so you will benefit from learning both.

share|improve this answer
5  
Anyone using terms like "force type safety down your throat" does not understand what type safety is or why it's useful. –  Mason Wheeler Feb 17 '13 at 5:05
7  
@MasonWheeler: anyone making a sweeping conclusion from a single phrase will find himself wrong more often than otherwise. Like, e.g., in this case. –  sds Feb 17 '13 at 6:00
3  
Since the topic is languages, the term "down your throat" is appropriate and apt imagery. –  luser droog Feb 17 '13 at 7:30
    
What's your definition of powerful in the context of type systems? –  KChaloux Mar 21 '13 at 15:39
1  
@KChaloux: I meant "expressive", as clarified by the example. –  sds Mar 21 '13 at 15:40
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.