Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

CL type system is more expressive 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,...,30.

However, Lisp compilers does not force their understanding of type safety down your throat, so you can ignore their "notes" - at your own risk.

This means that you can write Haskell in Lisp (so to speak) by declaring all value 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 strong static typing, use Haskell or OCaml, if you want strong dynamic typing, use Lisp. If you want weak static typing, use C, if you want weak dynamic typing, use Perl/Python. Each path has its advantages (and zealots) and disadvantages (and detractors), so you will benefit from learning all of them.

share|improve this answer
15  
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
8  
@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
1  
@KChaloux: I meant "expressive", as clarified by the example. – sds Mar 21 '13 at 15:40
3  
You've got it all backwards. Dynamic typing is a special case of static typing, where you force the programmer to use 1 type for everything. I can do the same thing (verbosely) in most statically-typed languages by declaring every variable as type Object or whatever the root of the type tree is. This is less expressive, because you're deprived of the option of saying that certain variables can only contain certain values. – Doval Aug 22 '14 at 15:13

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.