POV-Ray : Newsgroups : povray.pov4.discussion.general : I want to be rid of my stupid mistakes : Re: I want to be rid of my stupid mistakes Server Time
6 May 2024 12:59:14 EDT (-0400)
  Re: I want to be rid of my stupid mistakes  
From: Robert Dawson
Date: 18 Jan 2010 14:55:00
Message: <web.4b54bb7597aca27178cf40cc0@news.povray.org>
"bgimeno" <bgimeno[at]persistencia[dot]org> wrote:
> The following code is perfectly valid to the present version, but does not
> produce anything.
>
> #declare FooCount = 0 ;
> #while (FooCount < 100 )
> sphere {<0,FooCount,0>,1 pigment { rgb< 1, 1, 0> } }
> // #declare FooCount = FooCount + 1 ; // note this missing line
> #end
>
> I suppose that a "detector" of infinite loops is it too much to ask?

   Yes, that is basically what Alan Turing showed many years ago.  The control
syntax of  POV-Ray is powerful enough that the halting problem is undecidable.

   What would be possible is a restricted syntax for looping ("dummy variables
for dummies"?) that could be checked and that would guarantee no infinite loops.
 For instance, a simple For-Next syntax in which the dummy variable could not be
modified within the body of the loop would allow most things that most POV users
want to do.

      On the other hand, unless nesting loops were also forbidden, you could
still easily write a nest of loops that would require 10^100 years to run; and
nesting is something that POV users would miss.  So I don't think there is any
good solution.

Robert Dawson


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.