🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.functional
Article #12

Recursion meets GOTO

#12
From: ASpecT (=jvh+ric)
Date: Wed, 28 Oct 1992 10:18
32 lines
2723 bytes
Scenario: I wrote a functional program which works similar to a make tool but
          is able to parallelize the jobs by using other machines in a network
          via RPC and TCP/IP. This works fine for a long time now but some users
          informed me about occasional 'core dumps' while running this program.
          In such cases they restart the program and everything works fine then.
Research: Now I've got this 'core dumped' too and some investigations showed up
          that 'core dumped' is actually a 'stack overflow'. I located a function
          which works like this (written in a kind of Miranda style)
              execute jobs = execute jobs, if nobody_has_finished_now jobs
                           = execute (update jobs), if somebody_has_finished jobs
                           = done, if all_done jobs
          Of cause the function is more complicate in reality but this one shows
          up the problem too. The parameter jobs should contain informations about
          running jobs (on other machines) waiting jobs and ready jobs. If some
          jobs take long time on other machines the function would 'loop' in the
          first rule. It is easy to see that this eats up the stack space if
          the compiler/interpreter is not so 'kind' to convert it into a loop.
Problem:  Our compiler is so kind to remove tail recursion as well as tail
          recursion modulo cons. I know that ('cause I developed the compiler) and
          I know the exact circumstances when recursion is eliminated - in that
          case above I just made a 'mistake'. But what about other users of my
          language. What about users of any functional language i.e. Miranda,
          ML, Haskell. It seems to me that some 'optimisations' made by 
          compilers/interpreters have great influence on WHAT IS POSSIBLE TO
          WRITE/RUN IN A LANGUAGE. Should one include such demands into the
          language definition i.e. recursion removal, selective update, memory
          management, fold/unfold strategies and so on?

-- 
o  O O o           |  Joern von Holten
 \/|/\/  .         |    Uni Bremen
  //\   Let please |
Technical Details
Message-ID: <1992Oct28.101805.11911@informatik.uni-bremen.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!ubrinf!sun1g!aspect
References: <1ccaamINNgbt@uwm.edu> <BJORNL.92Oct26175238@asia.sics.se> <TMB.92Oct27115652@arolla.idiap.ch>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.functional
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!ubrinf!sun1g!aspect
From: aspect@sun1g.informatik.Uni-Bremen.DE (ASpecT (=jvh+ric))
Subject: Recursion meets GOTO
Message-ID: <1992Oct28.101805.11911@informatik.uni-bremen.de>
Sender: aspect@sun1g (ASpecT (=jvh+ric))
Nntp-Posting-Host: sun1g
Organization: Universitaet Bremen
References: <1ccaamINNgbt@uwm.edu> <BJORNL.92Oct26175238@asia.sics.se> <TMB.92Oct27115652@arolla.idiap.ch>
Date: Wed, 28 Oct 1992 10:18:05 GMT
Lines: 32