Loading ...
Sorry, an error occurred while loading the content.

Languages as Safety Nets

Expand Messages
  • Shlomi Fish
    I went out to the Great Language Shootout site and looked at the Fibonnaci example. Surprisingly O Caml out-performed C by far. Then I looked better and
    Message 1 of 1 , Sep 26, 2002
    • 0 Attachment
      I went out to the "Great Language Shootout" site and looked at the
      Fibonnaci example. Surprisingly O'Caml out-performed C by far. Then I
      looked better and guess what? It was this:

      f(0) = 0
      f(1) = 1
      f(n >= 2) = f(n-1) + f(n-2)

      Which as is known is a brain-dead, tree-recursive, exponential time way to
      calculate the Fibonnaci series. But in O'Caml it works because it is
      functional and has good caching. Does not work in Haskell, because of its
      Lazy Evaluation, and does not work in C or in Perl, because these languages
      do as they are told.

      This naturally made me think of Joel Spolsky's "Back to Basics" article where
      he says that:

      strcpy(dest,src1)
      strcat(dest,src2)
      strcat(dest,src3)

      is brain-dead because the pointer keeps starting from the start of dest.
      In Perl or Java on the other hand, where strings are of arbitrary length
      and contain their number of elements, it will work fine. I once modified a
      portion of Freecell Solver from the exact same side-effect (without Joel had
      anything to do with it, I just realized it was a bad idea)

      Now, the question is what next? How can the languages of the future save
      programmers from themselves? Or should they?

      Regards,

      Shlomi Fish

      There is no IGLU Cabal! It was implemented in a language which had an Oracle
      for an NP-Complete Problem and thus became deprecated.




      ----------------------------------------------------------------------
      Shlomi Fish shlomif@...
      Home Page: http://t2.technion.ac.il/~shlomif/
      Home E-mail: shlomif@...

      "Let's suppose you have a table with 2^n cups..."
      "Wait a second - is n a natural number?"
    Your message has been successfully submitted and would be delivered to recipients shortly.