Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-24 Thread Tomasz Zielonka
On Sun, Oct 24, 2004 at 01:39:06AM +0200, Peter Simons wrote: > What happens when a System.IO.Handle falls out of scope > without being explicitly hClosed? Is that a resource leak? > Or will the RTS close the handle for me? AFAIK, Handles have finalisers which close them, but I don't know if GHC t

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-24 Thread Sven Panne
Tomasz Zielonka wrote: AFAIK, Handles have finalisers which close them, but I don't know if GHC triggers garbage collection when file descriptors run out. If not, you will have problems if you manage to run out of fds between GCs. Yes, in GHC and Hugs handles are flushed and closed automatically d

RE: [Haskell-cafe] Are handles garbage-collected?

2004-10-24 Thread Conal Elliott
y. Cheers, - Conal -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tomasz Zielonka Sent: Sunday, October 24, 2004 1:33 AM To: Peter Simons Cc: [EMAIL PROTECTED] Subject: Re: [Haskell-cafe] Are handles garbage-collected? On Sun, Oct 24, 2004 at 01:39:06AM +0

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-24 Thread Marcin 'Qrczak' Kowalczyk
"Conal Elliott" <[EMAIL PROTECTED]> writes: > I'm puzzled why explicit bracketing is seen as an acceptable solution. > It seems to me that bracketing has the same drawbacks as explicit memory > management, namely that it sometimes retains the resource (e.g., memory > or file descriptor) longer tha

RE: [Haskell-cafe] Are handles garbage-collected?

2004-10-24 Thread Glynn Clements
Conal Elliott wrote: > > > What happens when a System.IO.Handle falls out of scope > > > without being explicitly hClosed? Is that a resource leak? > > > Or will the RTS close the handle for me? > > > > AFAIK, Handles have finalisers which close them, but I don't know if GHC > > triggers garbage

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-24 Thread Sven Panne
Conal Elliott wrote: I'm puzzled why explicit bracketing is seen as an acceptable solution. It seems to me that bracketing has the same drawbacks as explicit memory management, namely that it sometimes retains the resource (e.g., memory or file descriptor) longer than necessary (resource leak) and

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-24 Thread Remi Turk
On Sun, Oct 24, 2004 at 12:19:59PM -0700, Conal Elliott wrote: > I'm puzzled why explicit bracketing is seen as an acceptable solution. > It seems to me that bracketing has the same drawbacks as explicit memory > management, namely that it sometimes retains the resource (e.g., memory > or file desc

RE: [Haskell-cafe] Are handles garbage-collected?

2004-10-24 Thread Conal Elliott
PROTECTED] Subject: Re: [Haskell-cafe] Are handles garbage-collected? On Sun, Oct 24, 2004 at 12:19:59PM -0700, Conal Elliott wrote: > I'm puzzled why explicit bracketing is seen as an acceptable solution. > It seems to me that bracketing has the same drawbacks as explicit memory >

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-24 Thread Ketil Malde
Remi Turk <[EMAIL PROTECTED]> writes: > IMO, [bracket] does indeed have those same drawbacks. (Although the > traditional "explicit memory management model" is alloc/free, > which is much worse than bracket/withFile) Isn't bracket more like stack allocated memory? And most problems with explicit

RE: [Haskell-cafe] Are handles garbage-collected?

2004-10-25 Thread Simon Marlow
On 24 October 2004 20:51, Sven Panne wrote: > IMHO it would be best to use explicit bracketing where possible, and > hope for the RTS/GC to try its best when one runs out of a given > resource. Admittedly the current Haskell implementations could be > improved a little bit in the last respect. In

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-25 Thread Marcin 'Qrczak' Kowalczyk
"Simon Marlow" <[EMAIL PROTECTED]> writes: > At the moment performGC doesn't actually run any finalizers. It > schedules a thread to run the finalizers, and you hope the thread runs > soon. So if you're running performGC for the purposes of finalization, > then almost certainly (performGC >> yie

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-25 Thread Remi Turk
On Mon, Oct 25, 2004 at 08:46:41AM +0200, Ketil Malde wrote: > Remi Turk <[EMAIL PROTECTED]> writes: > > > IMO, [bracket] does indeed have those same drawbacks. (Although the > > traditional "explicit memory management model" is alloc/free, > > which is much worse than bracket/withFile) > > Isn't

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-25 Thread Remi Turk
On Mon, Oct 25, 2004 at 02:14:28PM +0100, Simon Marlow wrote: > On 24 October 2004 20:51, Sven Panne wrote: > > > IMHO it would be best to use explicit bracketing where possible, and > > hope for the RTS/GC to try its best when one runs out of a given > > resource. Admittedly the current Haskell i

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-25 Thread Tomasz Zielonka
On Mon, Oct 25, 2004 at 08:55:46PM +0200, Remi Turk wrote: > P.S. Why do so many people (including me) seem to come to Haskell > from Python? It can't be just the indentation, can it? ;) How many? I don't. Best regards, Tom -- .signature: Too many levels of symbolic links _

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-25 Thread Marcin 'Qrczak' Kowalczyk
Remi Turk <[EMAIL PROTECTED]> writes: > Hm, I'm not sure about the "should". Garbage collection is meant > for memory, and anything making that less clear makes people > more likely to depend on incorrect assumptions. > And redefining GC to be a collection of _all_ garbage, instead of > just memor

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-25 Thread Remi Turk
On Mon, Oct 25, 2004 at 09:28:23PM +0200, Tomasz Zielonka wrote: > On Mon, Oct 25, 2004 at 08:55:46PM +0200, Remi Turk wrote: > > P.S. Why do so many people (including me) seem to come to Haskell > > from Python? It can't be just the indentation, can it? ;) > > How many? I don't. > > Best re

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-25 Thread Marcin 'Qrczak' Kowalczyk
Tomasz Zielonka <[EMAIL PROTECTED]> writes: >> P.S. Why do so many people (including me) seem to come to Haskell >> from Python? It can't be just the indentation, can it? ;) > > How many? I don't. And I don't either. But indeed I've seen more references to Haskell on Python lists than on ot

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-25 Thread David Menendez
Marcin 'Qrczak' Kowalczyk writes: > I would not be surprised if relying on GC to close open files would > be generally considered kosher in a few years - in cases when it has > little visible effects outside, i.e. excluding network connections, > but including reading configuration files. One of

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-25 Thread Sun Yi Ming
From: David Menendez <[EMAIL PROTECTED]> Subject: Re: [Haskell-cafe] Are handles garbage-collected? Date: Mon, 25 Oct 2004 22:51:34 -0400 > Marcin 'Qrczak' Kowalczyk writes: > > > I would not be surprised if relying on GC to close open files would > > be ge

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-26 Thread Ketil Malde
Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> writes: > - 8 times more popular on c.l.python than c.l.java, > - 11 times more popular on c.l.python than c.l.perl, > - 16 times more popular on c.l.python than c.l.c, but finally > - 4 times *less* popular on c.l.python than c.l.scheme, > i.e

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-26 Thread Sam Mason
Marcin 'Qrczak' Kowalczyk wrote: >I would not be surprised if relying on GC to close open files would >be generally considered kosher in a few years - in cases when it has >little visible effects outside, i.e. excluding network connections, >but including reading configuration files. The best idea

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-26 Thread Ben Rudiak-Gould
David Menendez wrote: >One of the goals of ReiserFS, if I recall correctly, is to create a >filesystem API that doesn't involve file handles. I wonder how far one >could get without explicitly dealing with file handles outside of the IO >library implementation. I tried to do this last year with my

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-26 Thread Marcin 'Qrczak' Kowalczyk
Sam Mason <[EMAIL PROTECTED]> writes: > The best idea I've seen is another one from Microsoft Research. > It's an extension to C that allows the the programmer to use the > type system to specify the lifetime of things. I'm worried about putting too many thing in types. For example many people be

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-26 Thread Shae Matijs Erisson
Ben Rudiak-Gould <[EMAIL PROTECTED]> writes: > For this to really work properly the whole OS needs to be designed > around it. Such OSes exist -- they're called "capability-based" -- but > like so many other good ideas this one hasn't generated much interest > in industry. I think we're stuck with

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-26 Thread William Lee Irwin III
Ben Rudiak-Gould <[EMAIL PROTECTED]> writes: >> For this to really work properly the whole OS needs to be designed >> around it. Such OSes exist -- they're called "capability-based" -- but >> like so many other good ideas this one hasn't generated much interest >> in industry. I think we're stuck w

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-26 Thread Tomasz Zielonka
On Mon, Oct 25, 2004 at 09:28:23PM +0200, Tomasz Zielonka wrote: > On Mon, Oct 25, 2004 at 08:55:46PM +0200, Remi Turk wrote: > > P.S. Why do so many people (including me) seem to come to Haskell > > from Python? It can't be just the indentation, can it? ;) > > How many? I don't. My road to

Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-26 Thread William Lee Irwin III
On Tue, Oct 26, 2004 at 10:22:23PM +0200, Tomasz Zielonka wrote: > My road to Haskell went from C, C++ and Perl through Ocaml, Clean and > Erlang. I was mainly motivated by dissatisfaction with languages I used > at the moment. I am very happy with Haskell and I think I'll be using it > for some ti

RE: [Haskell-cafe] Are handles garbage-collected?

2004-10-28 Thread Conal Elliott
] Subject: RE: [Haskell-cafe] Are handles garbage-collected? Conal Elliott wrote: > > > What happens when a System.IO.Handle falls out of scope > > > without being explicitly hClosed? Is that a resource leak? > > > Or will the RTS close the handle for me? > > > &g

Did you come to Haskell from Python? was Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-26 Thread Shae Matijs Erisson
Remi Turk <[EMAIL PROTECTED]> writes: > At least one. (Me) And, judging from the amount of references to > Python in these mailing-lists, I really doubt I'm the only one. At least two. I also came to Haskell from Python. > I actually met Haskell mostly by reading about it in the python > mailing

Re: Did you come to Haskell from Python? was Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-26 Thread Bryn Keller
Shae Matijs Erisson wrote: Remi Turk <[EMAIL PROTECTED]> writes: At least one. (Me) And, judging from the amount of references to Python in these mailing-lists, I really doubt I'm the only one. At least two. I also came to Haskell from Python. Me three. I actually met Haskell mostly by r

Re: Did you come to Haskell from Python? was Re: [Haskell-cafe] Are handles garbage-collected?

2004-10-26 Thread William Lee Irwin III
Remi Turk <[EMAIL PROTECTED]> writes: >> At least one. (Me) And, judging from the amount of references to >> Python in these mailing-lists, I really doubt I'm the only one. > On Tue, Oct 26, 2004 at 09:21:10PM +0200, Shae Matijs Erisson wrote: > At least two. I also came to Haskell from Python. I