Re: open-read/open-write
Ralf Juengling <[email protected]> Tue, 10 Nov 2009 07:20:10 -0800 (PST)
| Newsgroups | gmane.lisp.lush.devel |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 10 Nov 2009, Yann LeCun wrote: > Yes, I object. > > For an interactive srcipt language it's nice to have a function that > just throws an error, but for a "real" programming language, you need > one that just tells you the file doesn't exist so your program can > take corrective actions and not crash and burn (like fopen() in C). Ok. What bugs me is that open-read also returns '()' when a file does exist but it could not be opened for another reason (network proplems, no permission, too many files open, ...), and you have no clue what went wrong. How about we let open-read return '()' when a file does not exist but raise an error when an existing file cannot be opened? Ralf > > The solution is to keep the current open-write/read/append as they are > (changing them would break too many things), but to add another set > higher-level function that throws errors (although that is kind of > what "(reading <file> ....)" does). > > I don't have any good sugestions for name. Perhaps > file-open-r file-open-w file-open-a, or something. > > -- Yann > > > On Tuesday 10 November 2009, Ralf Juengling wrote: >> The functions 'open-read' and 'open-write' do not >> raise errors. The current behavior is this: >> >> "The empty list is returned when an error occurs while >> opening the file. .." >> >> I can see that this may be useful. But I believe the >> alternative behavior--open-read/write raising an error and >> printing an informative error message when the operation >> fails--is useful more often than the current behavior. >> >> Does anybody remember why the current behavior was chosen? >> Does anybody object if I change open-read/open-write (and >> open-append) in lush2 to raise errors? >> >> Ralf >> >> >> --------------------------------------------------------------------------- >> --- Let Crystal Reports handle the reporting - Free Crystal Reports 2008 >> 30-Day trial. Simplify your report design, integration and deployment - >> and focus on what you do best, core application coding. Discover what's >> new with Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Lush-devel mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/lush-devel >> > > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july