>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 makes open() and opendir() look a
>lot more Perlish to me.

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.  

>However, if we extended this some more, there's some interesting
>possibilities. Currently, if you want to open an FTP connection, you
>have to do something like this:

>   use Net::FTP;
>   my $ftp = new Net::FTP ("ftp.perl.com");
>   $ftp->login("user", "pass");

>And so on. Same for HTTP connections, etc. However, you could make
>open() extensible, almost like tie() or new()[1] in that it can bind
>objects to classes. So, to open a new FTP connection, maybe Perl6 could
>let you do this:

>   $ftp = open "ftp.perl.com/pub", Net::FTP;

>[1] I *know* new() is "just a function", but you know what I mean. :-)


What I *would* like to shoot down is this nutty assumption that
these quasi-constructors be named new().  Choose something in the
proper domain.  Is that a new client or a new server?  Is it
preconnected or not?  etc.

Avoid new().  Use something descriptive of what's happening.

--tom


Reply via email to