Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] recomendations for a functional language
- Date: Wed, 4 Nov 2009 21:49:01 +0900
- From: Jianshi Huang <jianshi.huang@example.com>
- Subject: Re: [tlug] recomendations for a functional language
- References: <20091101131525.5f4312bd.attila@example.com> <20091102082821.GA28406@example.com> <20091102115859.584591f3.attila@example.com> <a63167770911020238q2c68d37bt4efb354c91002470@example.com> <20091102112350.bf06bfd6.attila@example.com> <87hbtdtfch.fsf@example.com> <a63167770911020112q1bd12b27ub5209902a971a6c9@example.com> <20091102150646.GD16339@example.com> <a63167770911021615h14f8c2d4rf7ac6f7e3b44137a@example.com> <20091104013637.GF9636@example.com>
Since I'm a common lisp programmer I'd like to join your discussion. On Wed, Nov 4, 2009 at 10:36 AM, Curt Sampson <cjs@example.com> wrote: > Saved from bugs by the type system? Constantly. It's my primary tool to > verify that what I'm writing makes sense. > > I write about 1/5 the number of unit tests that I used to write, and > many of the ones now kicking around my biggest project I wrote for > comfort early on. Yet I still feel that I have better reliability than > in Ruby with five times the number of tests. I'll frequently do fairly > major refactorings on large and wide-ranging parts of code that have no > tests at all, relying entirely on the type system to make sure I make no > errors doing this. > > And that's before we even get into the really sophisticated features of > the type system. It's basically like learning yet another programming > language. I can say I largely agree with your opinion provide you have a sane type system like Haskell's (if it is C++, good luck). Dynamically typed language, which gives you the freedom also relies much on your responsibility. The benefit is you can easily code up a partial solution to guide you to the more general solutions. And once you have the whole image, you can turn to a more carefully designed approach, documenting all the interfaces, types, and adding some test cases. It doesn't matter which language you use, it matters how you think of the problem, if you can think mathematically, usually you are safe. In practice, if it's a well defined problem, I'll document all the function types, destructive semantics, exceptions and restarts. These are essential information for anyone who needs to use my code. Many people think since Common Lisp is a dynamically typed language, anything compile-time type safety checks are hopeless, this is actually very wrong. With type declaration (yes, common lisp supports optional type declaration) and a good compiler like SBCL, you will get warnings about type mismatches in compile-type. The problem is you have to make sure all the library function you use are either correct used (no missing cases) or fully type declared. Thus basically you are only safe in your own code. BTW, I think high quality libraries are much more important for dynamically typed languages. However, the problem is usually you don't have enough time to think systematically in every part of your software, and in that case, I really hope I can use some statically typed language for me to avoid making stupid mistakes. The result is lots of unnecessary type checkings which makes the code neither easy to understand nor safe to modify. Especially many common lisp programmers don't like to write comments and documents. Types are call conventions and documentations. So in a dynamically typed language, do everybody a favor, write down the function types (and exceptions)! (screaming...) > Note that type checking isn't required for pattern matching; Erlang > for example doesn't have compile-time type checking, yet has pattern > matching. However, I find that compile-time type checking, and notices > that you've missed a case in the pattern, to be exceedingly useful. > Agree! Cheers, Jianshi
- References:
- [tlug] recomendations for a functional language
- From: Attila Kinali
- Re: [tlug] recomendations for a functional language
- From: Curt Sampson
- Re: [tlug] recomendations for a functional language
- From: Attila Kinali
- Re: [tlug] recomendations for a functional language
- From: Alan Busby
- Re: [tlug] recomendations for a functional language
- From: Attila Kinali
- Re: [tlug] recomendations for a functional language
- From: Stephen J. Turnbull
- Re: [tlug] recomendations for a functional language
- From: Alan Busby
- Re: [tlug] recomendations for a functional language
- From: Curt Sampson
- Re: [tlug] recomendations for a functional language
- From: Alan Busby
- Re: [tlug] recomendations for a functional language
- From: Curt Sampson
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Files copied to USB thumb drive completely gone
- Next by Date: Re: [tlug] Files copied to USB thumb drive completely gone
- Previous by thread: Re: [tlug] Pattern Matching
- Next by thread: Re: [tlug] recomendations for a functional language
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links