how to prevent bugs without static type checking?

classic Classic list List threaded Threaded
44 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: how to prevent bugs without static type checking?

steve donovan
On Fri, Oct 26, 2012 at 3:43 PM, Javier Guerra Giraldez
<[hidden email]> wrote:
> don't you mean monkey-patching?  zoology can be hard!  ;-)

Oh yes, that was what I thought, but another animal came out!

steve d.

Reply | Threaded
Open this post in threaded view
|

Re: how to prevent bugs without static type checking?

Robert Virding
In reply to this post by spir ☣

----- Original Message -----

> From: "spir" <[hidden email]>
> To: [hidden email]
> 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

Reply | Threaded
Open this post in threaded view
|

RE: how to prevent bugs without static type checking?

Thijs Schreijer
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] 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" <[hidden email]>
> > To: [hidden email]
> > 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


Reply | Threaded
Open this post in threaded view
|

Re: how to prevent bugs without static type checking?

Jay Carlson
In reply to this post by Javier Guerra Giraldez


On Oct 26, 2012 9:44 AM, "Javier Guerra Giraldez" <[hidden email]> wrote:
>
> On Fri, Oct 26, 2012 at 1:23 AM, steve donovan
> <[hidden email]> wrote:
> > As an example of different language culture, Ruby tolerates
> > duck-typing and so people get into messes which are hard to reason
> > about. Lua people are much more reluctant to do that, even though it's
> > trivial to redefine string.match say.
>
> don't you mean monkey-patching?  zoology can be hard!  ;-)

Don't forget the Rescue Rangers--they're chipmunks.

http://en.wikipedia.org/wiki/Rescue_Rangers

123