[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: thoughts on onCleanup and handle classes
From: |
Jaroslav Hajek |
Subject: |
Re: thoughts on onCleanup and handle classes |
Date: |
Wed, 19 May 2010 07:22:16 +0200 |
> Matlab 2009b says:
>
>>> c = onCleanup (1)
>
> c =
>
> onCleanup handle
>
> Properties:
> task: 1
>
>
>>> clear c
>>>
> ==============================
>
Huh. I think this is a very bad idea, and I vote against copying it.
This will allow bugs like the following (which I think is very easily
made) to go unnoticed:
fid = fopen ("myfile.txt");
cleanup = onCleanup (fclose (fid)); % bug, but you can easily overlook it
also, the Matlab docs say that the argument should be a function
handle, there's no mention about anything else.
--
RNDr. Jaroslav Hajek, PhD
computing expert & GNU Octave developer
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz
Re: thoughts on onCleanup and handle classes, David Bateman, 2010/05/18