lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
> Behalf Of Robert Virding
> Sent: maandag 29 oktober 2012 14:07
> To: Lua mailing list
> Subject: Re: how to prevent bugs without static type checking?
> 
> 
> ----- Original Message -----
> > From: "spir" <denis.spir@gmail.com>
> > To: lua-l@lists.lua.org
> > Sent: Tuesday, 23 October, 2012 1:29:10 AM
> > Subject: Re: how to prevent bugs without static type checking?
> >
> > 2. way of thinking
> > I noticed the following: after programming for a long time only in
> > dynamic languages, when I then switch to static typing, for a while I
> > have about no type error (at compile-time, indeed); then they start to
> > happen, and finally I have many. I think, maybe, after some time we
> > start "programming-thinking"
> > differently. Dynamic programmers may have a clearer awareness about
> > types --that is, ultimately, the meaning of symbols-- and
> > unconsciously pay more attention to their coherence in the model.
> > Conversely, after some time, static programmers may start to rely on
> > the machine to do this job; and it does it well, provided your typing
> > is correct and clear. They become so-to-say lazy about that, not
> > uselessly spending their "neuronic power" in what a machine can do
> > (better).
> > Both are good, in my opinion.
> 
> Yes, I agree. I do very little Lua programming and program mainly in Erlang
> which is also dynamically typed. And I find that I make very few type errors or
> significant spelling errors. For Erlang we have a type checking tool (and other
> checks), dialyzer, and I find that running that on my applications finds very
> few errors.
> 
> I think that just because the system is dynamically typed doesn't mean you
> don't think about types, of course you do. If your application is to work
> properly the types must be correct. "Hacking" the types usually results in a
> right mess at the end. Perhaps not having static type checking forces you to
> be more careful about types.
> 
> Robert

In my experience it's even broader, static typing somehow makes my brain lazy, relying too much on the compiler to find stuff. Dynamic typing forces my head into being more careful (but it comes at no extra 'explicit' cost, its fully automatic after a while.
I even found that after a while switching back to .NET that the time I needed to debug new code (static .NET) dropped considerably, simply less mistakes.

Here's a nice link from a recent tweet on the topic; http://www.neverworkintheory.org/?p=432 

Thijs