[Gllug] OSS CMSs
Richard Jones
rich at annexia.org
Mon May 2 07:18:04 UTC 2005
On Sun, May 01, 2005 at 04:30:45PM +0100, Steve Nelson wrote:
> assert isInstance(s, Stack)
Which is a runtime error ...
> Seriously, though - to be fair, compile-time type checking won't catch
> all your type errors. If you write a library, for example, you have no
> way of knowing who's going to call you or what they're going to pass
> you. So run-time checking is essential.
Not so. In OCaml (and Haskell) type checking happens across module
boundaries, so you can't call a library with the wrong type either.
> In Python, we prefer to ask forgiveness rather than permission. We
> don't check the type of every object before trying to call a method on
> it; that generates huge amounts of mostly unnecessary code.
If all your type checking happens at compile time, as in OCaml, then
there is no need for any extra code at runtime. In fact compile time
type checking is a major win for performance, which is one of the
reasons that OCaml achieves within 25% of C speed.
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list