Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #15546

Re: abstraction: do haskell and lisp beat forth in abstraction? or no?

From Paul Rubin <no.email@nospam.invalid>
Newsgroups comp.lang.forth
Subject Re: abstraction: do haskell and lisp beat forth in abstraction? or no?
References (4 earlier) <68234264-6e8a-48ed-98f6-3b67f1d49b7e@googlegroups.com> <80bf6b64-7347-41ea-abf5-5f76f25faefd@o8g2000yqm.googlegroups.com> <b7b214e3-8b70-401d-ae6d-6cc2011f59a1@googlegroups.com> <k2gfvs$73l$1@dont-email.me> <1474602.OxUZWPKXN5@sunwukong.fritz.box>
Date 2012-09-08 18:04 -0700
Message-ID <7xvcfom2fy.fsf@ruckus.brouhaha.com> (permalink)
Organization Nightsong/Fort GNOX

Show all headers | View raw


Bernd Paysan <bernd.paysan@gmx.de> writes:
> Most of my program errors are actual logic errors, and unless you have a 
> system like Coq (which is not really ready to use for practical work), a 
> typechecker can't find these bugs.

In Python, if you say
    x = ((a + b) / (c + d)
the compiler might not spot possible lurking logic or type errors, but
it will immediately notice the unbalanced parentheses and tell you to
fix it.  One could imagine a language that allowed a value like
     d = 5)
so that the "x = ..." statement above would in fact be ok if d had that
value, and otherwise you'd get a runtime error.  Most of the time, where
d is an ordinary number, the unbalanced parentheses in the first
expression is an actual error, and it's easier to have the compiler
report it than to wait for a runtime exception to show up during testing
and then debug it.  You can imagine the requirement of parentheses
balancing as being in the way sometimes, but most of the time it's not a
problem in practice.  Good type systems are similar to that.  More
problems get caught at compile time, fewer wait til run time, and
(perhaps more importantly) if you add a chunk of new code to an existing
program, it gets some sanity checking automatically, courtesy of the
compiler.  It's not B&D, it's just useful.  Per "Real World Haskell":

    A helpful analogy to understand the value of static typing is to
    look at it as putting pieces into a jigsaw puzzle. In Haskell, if a
    piece has the wrong shape, it simply won't fit. In a dynamically
    typed language, all the pieces are 1x1 squares and always fit, so
    you have to constantly examine the resulting picture and check
    (through testing) whether it's correct.

The "jigsaw puzzle" feeling is really palpable and I noticed it with the
first Haskell program I wrote, a cryptography library where the
application was not allowed to decrypt with encryption-only keys and
that sort of thing.  I had done something similar in Python earlier,
using OOP and runtime checks, but static types made it even more trivial
to make sure that such stuff didn't get confused.

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

abstraction: do haskell and lisp beat forth in abstraction? or no? gavino_himself <visploveslisp@gmail.com> - 2012-08-22 13:20 -0700
  Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Jason Damisch <jasondamisch@yahoo.com> - 2012-08-22 17:31 -0700
  Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Ron Aaron <rambamist@gmail.com> - 2012-08-23 06:25 +0300
    Re: abstraction: do haskell and lisp beat forth in abstraction? or no? jacko <jackokring@gmail.com> - 2012-08-24 08:41 -0700
      Re: abstraction: do haskell and lisp beat forth in abstraction? or no? "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-08-25 03:46 -0400
        Re: abstraction: do haskell and lisp beat forth in abstraction? or no? jacko <jackokring@gmail.com> - 2012-08-25 10:03 -0700
      Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-08-25 04:51 -0700
        Re: abstraction: do haskell and lisp beat forth in abstraction? or no? "Rod Pemberton" <do_not_have@notemailnot.cmm> - 2012-08-26 06:03 -0400
        Re: abstraction: do haskell and lisp beat forth in abstraction? or no? John Passaniti <john.passaniti@gmail.com> - 2012-08-26 20:19 -0700
          Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-08-27 04:38 -0700
            Re: abstraction: do haskell and lisp beat forth in abstraction? or no? John Passaniti <john.passaniti@gmail.com> - 2012-08-27 12:37 -0700
              Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Unknown <dog@gmail.com> - 2012-08-29 18:53 +0000
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Jason Damisch <jasondamisch@yahoo.com> - 2012-08-29 12:30 -0700
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2012-08-29 14:37 -0500
              Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Unknown <dog@gmail.com> - 2012-08-29 18:53 +0000
              Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Unknown <dog@gmail.com> - 2012-09-08 22:14 +0000
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Bernd Paysan <bernd.paysan@gmx.de> - 2012-09-09 01:12 +0200
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Paul Rubin <no.email@nospam.invalid> - 2012-09-08 18:04 -0700
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? "Elizabeth D. Rather" <erather@forth.com> - 2012-09-09 15:01 -1000
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Paul Rubin <no.email@nospam.invalid> - 2012-09-09 18:57 -0700
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? "Elizabeth D. Rather" <erather@forth.com> - 2012-09-09 18:47 -1000
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-09-10 01:19 -0700
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Paul Rubin <no.email@nospam.invalid> - 2012-09-10 08:18 -0700
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-09-10 16:21 +0000
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2012-09-10 18:41 +0100
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Bernd Paysan <bernd.paysan@gmx.de> - 2012-09-11 00:37 +0200
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? "Paul E. Bennett" <Paul_E.Bennett@topmail.co.uk> - 2012-09-11 19:07 +0100
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Mark Wills <forthfreak@gmail.com> - 2012-09-12 00:32 -0700
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Doug Hoffman <glidedog@gmail.com> - 2012-09-10 09:09 -0400
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Mark Wills <markrobertwills@yahoo.co.uk> - 2012-09-10 06:49 -0700
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-09-10 15:17 +0000
                Re: abstraction: do haskell and lisp beat forth in abstraction? or  no? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-09-10 14:17 +0000
                Re: abstraction: do haskell and lisp beat forth in abstraction? or  no? Doug Hoffman <glidedog@gmail.com> - 2012-09-14 11:54 -0400
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? Paul Rubin <no.email@nospam.invalid> - 2012-09-15 02:11 -0700
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2012-09-18 12:11 +0000
                Re: abstraction: do haskell and lisp beat forth in abstraction? or no? gavino_himself <visploveslisp@gmail.com> - 2012-09-14 03:22 -0700
        Re: abstraction: do haskell and lisp beat forth in abstraction? or no? gavino_himself <visploveslisp@gmail.com> - 2012-08-30 20:13 -0700
    Re: abstraction: do haskell and lisp beat forth in abstraction? or no? gavino_himself <visploveslisp@gmail.com> - 2012-08-30 20:16 -0700
      Re: abstraction: do haskell and lisp beat forth in abstraction? or no? "Elizabeth D. Rather" <erather@forth.com> - 2012-08-30 17:44 -1000

csiph-web