Re: try/catch (Was: Re: RFC: Modify open() and opendir() to return handles)

2000-08-04 Thread Peter Scott
At 11:25 AM 8/4/00 +0200, Johan Vromans wrote: >[Quoting Hildo Biersma, on August 4 2000, 08:40, in "Re: try/catch (Was: "] > > Yes, but... this is largely casued by the fact that Java requires you to > > declare any uncaught parameters on your method specification, and this > > tends to have a na

Re: try/catch (Was: Re: RFC: Modify open() and opendir() to return handles)

2000-08-04 Thread Steve Simmons
On Fri, Aug 04, 2000 at 09:10:38AM +0200, Johan Vromans wrote: > You missed the point. > > If you need 6+ lines of code for each elementary error check, this is > what is going to happen . . . You're correct, but that's not what I was suggesting. The magic words are `for each elementary error c

Re: try/catch (Was: Re: RFC: Modify open() and opendir() to return handles)

2000-08-04 Thread Tom Christiansen
>> Why would we ever remove a syscall!?!? >I vote for migration to a module. And sysopen and fcntl and waitpid and ioctl

Re: try/catch (Was: Re: RFC: Modify open() and opendir() to return handles)

2000-08-04 Thread Nathan Torkington
Tom Christiansen writes: > >Maybe we should address this? If we're keeping syscalls just because a > >possible replacement module is just written wrong, we should fix this. > > Why would we ever remove a syscall!?!? I vote for migration to a module. If you're going to use the long-winded form o

Re: try/catch (Was: Re: RFC: Modify open() and opendir() to return handles)

2000-08-04 Thread Tom Christiansen
>Tom Christiansen wrote: >> >> >> Thats just because IO::Socket is done wrong >> >> >Maybe we should address this? If we're keeping syscalls just because a >> >possible replacement module is just written wrong, we should fix this. >> >> Why would we ever remove a syscall!?!? >Sorry, wrong verb

Re: try/catch (Was: Re: RFC: Modify open() and opendir() to return handles)

2000-08-04 Thread Nathan Wiger
Tom Christiansen wrote: > > >> Thats just because IO::Socket is done wrong > > >Maybe we should address this? If we're keeping syscalls just because a > >possible replacement module is just written wrong, we should fix this. > > Why would we ever remove a syscall!?!? Sorry, wrong verbage. I me

Re: try/catch (Was: Re: RFC: Modify open() and opendir() to return handles)

2000-08-04 Thread Tom Christiansen
>> Thats just because IO::Socket is done wrong >Maybe we should address this? If we're keeping syscalls just because a >possible replacement module is just written wrong, we should fix this. Why would we ever remove a syscall!?!? --tom

Re: try/catch (Was: Re: RFC: Modify open() and opendir() to return handles)

2000-08-04 Thread Nathan Wiger
> Thats just because IO::Socket is done wrong Maybe we should address this? If we're keeping syscalls just because a possible replacement module is just written wrong, we should fix this. I don't like giving up low-level control either, but imagine something like this: $port = shift || 2345

Re: try/catch (Was: Re: RFC: Modify open() and opendir() to return handles)

2000-08-04 Thread Graham Barr
On Fri, Aug 04, 2000 at 05:09:13AM -0600, Tom Christiansen wrote: > This is my argument against obsolescing the general-purpose socket() et al. > syscalls in deference to the IO::Socket stuff: Absolutly. A high level API is ok for those who want it. But you should never take away the low-level s

Re: try/catch (Was: Re: RFC: Modify open() and opendir() to return handles)

2000-08-04 Thread Tom Christiansen
>> If you do it the C++ way, you can say: >> try { >> first_sub_that_throws_exceptions(); >> second_sub_that_throws_exceptions(); >> } catch { >> it went wrong >> } >How does 'it went wrong' know _which_ of the subs went wrong? This is my argument against obsolescing

Re: try/catch (Was: Re: RFC: Modify open() and opendir() to return handles)

2000-08-04 Thread Graham Barr
On Fri, Aug 04, 2000 at 11:25:49AM +0200, Johan Vromans wrote: > How does 'it went wrong' know _which_ of the subs went wrong? For > example: > > try { > open(file1); > open(file2); > open(file3); > } catch { > error("could not open one of the file(s)"); > } > > which is no

Re: try/catch (Was: Re: RFC: Modify open() and opendir() to return handles)

2000-08-04 Thread Johan Vromans
[Quoting Hildo Biersma, on August 4 2000, 08:40, in "Re: try/catch (Was: "] > Yes, but... this is largely casued by the fact that Java requires you to > declare any uncaught parameters on your method specification, and this > tends to have a nasty oil-slick effect. > > If you do it the C++ way, y

Re: try/catch (Was: Re: RFC: Modify open() and opendir() to return handles)

2000-08-04 Thread Hildo Biersma
Johan Vromans wrote: > You missed the point. > > If you need 6+ lines of code for each elementary error check, this is > what is going to happen (and it _does_ happen in almost every Java > program I've seen): > > try { >open file >while read a record > process its

try/catch (Was: Re: RFC: Modify open() and opendir() to return handles)

2000-08-04 Thread Johan Vromans
Steve Simmons <[EMAIL PROTECTED]> writes: > On Thu, Aug 03, 2000 at 08:54:35PM +0200, Johan Vromans wrote: > >try { > > java > >} > >catch (Exception e) { > > think again > >} > > I like this. It's perlish in that it builds off of a well-defined and > proven mechanis

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Nathan Wiger
> In fact, you may as well go the whole way and say that all IO is done via > optimised IO objects (ie include sockets etc). IO::File and friends > without the overhead. All of the current open functions simply pass these > objects around. I'll stick this in there, definitely. This is just what I

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Nathan Wiger
> Are you saying they don't look Perlish now? > > And no, all you guys, I'm not trying to shoot down a monadic, > object-returning open. Please don't assume that. As funny as it sounds, yes. Mind you, they're not really too weird. But compared to how most other functions have turned out working

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Tim Jenness
On Thu, 3 Aug 2000, Nathan Wiger wrote: > > sysopen() should probably be included in the list as well. > > Good point. > In fact, you may as well go the whole way and say that all IO is done via optimised IO objects (ie include sockets etc). IO::File and friends without the overhead. All of th

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Nathan Wiger
> sysopen() should probably be included in the list as well. Good point. -Nate

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Steve Simmons
On Thu, Aug 03, 2000 at 08:54:35PM +0200, Johan Vromans wrote: > Peter Scott <[EMAIL PROTECTED]> writes: > > If we get a good-looking exception throwing/catching mechanism and > > syntax, this may not matter. >try { > java >} >catch (Exception e) { > think again >} I

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Tom Christiansen
>If we were to agree to make the basic syntax of open() something like: > $object = open [$filename], [$class]; >There's a lot of cool stuff we could do. In the simplest "mostly looks >like Perl5" cases, open() can work like shown above. In fact, I'd be >plenty happy with just this, since it m

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Johan Vromans
Peter Scott <[EMAIL PROTECTED]> writes: > At 09:01 AM 8/3/00 -0600, Tom Christiansen wrote: > >Syscalls should use errno. Others may vary. > > If we get a good-looking exception throwing/catching mechanism and > syntax, this may not matter. try { java } catch (Exception e) {

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Johan Vromans
Bart Lateur <[EMAIL PROTECTED]> writes: > >The open() and opendir() functions would have to be altered to take one > >argument (not two) and return the corresponding file object or undef. > > Actually, open() currently CAN have just one parameter. Does that matter much? After all, we may chang

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Tim Jenness
On Thu, 3 Aug 2000, Nathan Wiger wrote: > Tom Christiansen wrote: > > > > >On Thu, Aug 03, 2000 at 06:40:30AM -0600, Tom Christiansen wrote: > > >> >Modify open() and opendir() to return filehandle objects > > >> > > >> Here are some things that that will be a problem for: > > > > >I did not se

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Tim Jenness
On Thu, 3 Aug 2000, Graham Barr wrote: > On Thu, Aug 03, 2000 at 09:01:44AM -0600, Tom Christiansen wrote: > > >On Thu, Aug 03, 2000 at 08:13:09AM -0600, Tom Christiansen wrote: > > >> No, that's gross. A failed constructor should return undef. See my > > >> later message. > > > > >That has a

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Nathan Wiger
Tom Christiansen wrote: > > >On Thu, Aug 03, 2000 at 06:40:30AM -0600, Tom Christiansen wrote: > >> >Modify open() and opendir() to return filehandle objects > >> > >> Here are some things that that will be a problem for: > > >I did not see any that would be a problem. > > It's not as convenien

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Peter Scott
At 09:01 AM 8/3/00 -0600, Tom Christiansen wrote: > >On Thu, Aug 03, 2000 at 08:13:09AM -0600, Tom Christiansen wrote: > >> No, that's gross. A failed constructor should return undef. See my > >> later message. > > >That has always been my view. But then people say "but why did it fail" > >and h

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Jonathan Scott Duff
On Thu, Aug 03, 2000 at 03:19:35PM +0100, Graham Barr wrote: > I am open to suggestions. Of course one may be move the connect > out of the constructor. But that leaves the constructor > being nothin more than a bless. Here's a modification of my previous evil suggestion: Have a global (existing

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Graham Barr
On Thu, Aug 03, 2000 at 09:01:44AM -0600, Tom Christiansen wrote: > >On Thu, Aug 03, 2000 at 08:13:09AM -0600, Tom Christiansen wrote: > >> No, that's gross. A failed constructor should return undef. See my > >> later message. > > >That has always been my view. But then people say "but why did

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Tom Christiansen
>On Thu, Aug 03, 2000 at 08:13:09AM -0600, Tom Christiansen wrote: >> No, that's gross. A failed constructor should return undef. See my >> later message. >That has always been my view. But then people say "but why did it fail" >and having global variables does not scale well. Syscalls should

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Graham Barr
On Thu, Aug 03, 2000 at 08:13:09AM -0600, Tom Christiansen wrote: > No, that's gross. A failed constructor should return undef. See my > later message. That has always been my view. But then people say "but why did it fail" and having global variables does not scale well. My comment comes mai

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Tom Christiansen
>Are you saying that piped opens returning a "filehandle" object makes >testing for failure more troublesome? If so, I have an evil proposal >for you ... Let's make an "error" object (I hate to use that term) >that's *always* false but has some state we can get at. This thing would >encapsulate

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Jonathan Scott Duff
On Thu, Aug 03, 2000 at 06:57:27AM -0600, Tom Christiansen wrote: > >On Thu, Aug 03, 2000 at 06:40:30AM -0600, Tom Christiansen wrote: > >> >Modify open() and opendir() to return filehandle objects > >> > >> Here are some things that that will be a problem for: > > >I did not see any that would

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Tom Christiansen
>On Thu, Aug 03, 2000 at 06:40:30AM -0600, Tom Christiansen wrote: >> >Modify open() and opendir() to return filehandle objects >> >> Here are some things that that will be a problem for: >I did not see any that would be a problem. It's not as convenient. --tom

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Graham Barr
On Thu, Aug 03, 2000 at 06:40:30AM -0600, Tom Christiansen wrote: > >Modify open() and opendir() to return filehandle objects > > Here are some things that that will be a problem for: I did not see any that would be a problem. Graham.

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Tom Christiansen
>Modify open() and opendir() to return filehandle objects Here are some things that that will be a problem for: open(SESAME, "| output-pipe-command") # set up an output filter open(SESAME, "input-pipe-command |") # set up an input filter open SPOOLER, "| cat -v | lpr -h 2>/dev/nul

Re: RFC: Modify open() and opendir() to return handles

2000-08-03 Thread Tom Christiansen
>Actually, open() currently CAN have just one parameter. What it does, is >use a filehandle and a scalar variable with the same name, so >Nope. Get rid of it! (p.s. Has anybody ever actually used this feature, Yes, of course. That isn't an argument for its persistence, however. --tom

Re: RFC: Modify open() and opendir() to return handles

2000-08-02 Thread Bart Lateur
On Wed, 02 Aug 2000 20:58:51 -0700, Nathan Wiger wrote: >=head1 IMPLEMENTATION > >The open() and opendir() functions would have to be altered to take one >argument (not two) and return the corresponding file object or undef. Actually, open() currently CAN have just one parameter. What it does, i

Re: Don't reply! RFC: Modify open() and opendir() to return handles

2000-08-02 Thread Nathan Wiger
Please don't reply to this one or threadlists will be screwed up! Reply to the second (auto-generated) one later in the perl6-language mailbox. (Hit the button a second before Nat's email! Oh, well...) Nathan Wiger wrote: > > =head1 TITLE > > Modify open() and opendir() to return filehandle ob

RFC: Modify open() and opendir() to return handles

2000-08-02 Thread Nathan Wiger
=head1 TITLE Modify open() and opendir() to return filehandle objects =head1 VERSION Maintainer: Nathan Wiger <[EMAIL PROTECTED]> Date: 2 Aug 2000 Version: 1.0 Mailing-List: perl6-language =head1 ABSTRACT Currently, open() and opendir() are given handle arguments, whose values are twiddled if