POV-Ray : Newsgroups : povray.off-topic : Haskell raving : Re: Haskell raving Server Time
12 Oct 2024 03:17:42 EDT (-0400)
  Re: Haskell raving  
From: Tim Attwood
Date: 31 Oct 2007 17:17:47
Message: <4728ff0b@news.povray.org>
>  That didn't really answer the question of whether it is able to drop
> the parts which are no longer used.

The answer is yes, mostly.

Data is automatically destroyed as it goes out of scope. So if you
have a process that works one line at a time, then one line at a time
will be disposed, if you have a process that works on single chars
then one char at a time is disposed.

In general, Haskel takes some input to a function,
produces some new data output in fresh memory,
and then disposes of the input,
and frees that memory if no other function references it,
eventually GC reclaims the memory. (or you can
manually trigger a GC if you want).

File IO is imperative, so it can be treated in manners
typical of other languages. You don't need to bind >>=
files to processes, it's perfectly OK to read one line
at a time and do something with it until the EOF is reached.


Post a reply to this message

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