[29381] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 625 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 6 14:45:50 2007

Date: Fri, 6 Jul 2007 11:45:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 6 Jul 2007     Volume: 11 Number: 625

Today's topics:
        retrieving news messages <invalid@invalid.nyet>
    Re: retrieving news messages <see.sig@rochester.rr.com>
    Re: retrieving news messages <invalid@invalid.nyet>
    Re: retrieving news messages <tadmc@seesig.invalid>
    Re: retrieving news messages <spamtrap@dot-app.org>
    Re: retrieving news messages <bik.mido@tiscalinet.it>
    Re: retrieving news messages <joe@inwap.com>
    Re: retrieving news messages <invalid@invalid.nyet>
    Re: retrieving news messages <invalid@invalid.nyet>
    Re: retrieving news messages <noreply@gunnar.cc>
    Re: retrieving news messages <tadmc@seesig.invalid>
    Re: retrieving news messages <sbryce@scottbryce.com>
    Re: retrieving news messages <joe@inwap.com>
    Re: retrieving news messages <joe@inwap.com>
    Re: retrieving news messages <noreply@gunnar.cc>
    Re: The Modernization of Emacs: terminology buffer and  <scobloke2@infotop.co.uk>
    Re: The Modernization of Emacs: terminology buffer and  <borud-news@borud.no>
    Re: The Modernization of Emacs: terminology buffer and  <blmblm@myrealbox.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 4 Jul 2007 19:36:18 -0400
From: "Wade Ward" <invalid@invalid.nyet>
Subject: retrieving news messages
Message-Id: <hpWdncF3XKuvshHbnZ2dnUVZ_oqmnZ2d@comcast.com>

#!/usr/bin/env perl
use strict;
use warnings;
use Net::NNTP;

my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1} );
my $USER = 'zaxfuuq';
my $PASS = 'redacted';

my $SERVER = 'newsgroups.comcast.net';
my $PORT = 119;

my $c = new Net::NNTP($SERVER, $PORT) or die $!;
$c->authinfo($USER,$PASS) or die $!;

$nntp->group('comp.lang.perl.misc')
   or die "failed to set group c.l.p.m.\n";
my $msg_ids_ref = $nntp->newnews(time() - 24*60*60);
die "Failed to retrieve message ids\n" unless @{$msg_ids_ref};

open my $ofh, '>', 'articles.txt'
   or die "Cannot open articles.txt: $!";
for my $msg_id (@{$msg_ids_ref}) {
   $nntp->article($msg_id, $ofh)
      or die "Failed to retrieve article $msg_id\n";
}
close $ofh;
__END__
I keep on trying this to make this script to run, without success.  I think 
I'm making some headway on it though.  Instead of a grab bag of errors, 
perl.exe is telling me that I have "an invalid argument" on this line:
my $c = new Net::NNTP($SERVER, $PORT) or die $!;
It takes a couple seconds for it to tell me that, so I think it might be 
almost there.  Ideas?  Thanks in advance.
-- 
Wade Ward 




------------------------------

Date: Wed, 04 Jul 2007 20:35:36 -0400
From: Bob Walton <see.sig@rochester.rr.com>
Subject: Re: retrieving news messages
Message-Id: <468c3cdb$0$16577$4c368faf@roadrunner.com>

Wade Ward wrote:
> #!/usr/bin/env perl
> use strict;
> use warnings;
> use Net::NNTP;
> 
> my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1} );
> my $USER = 'zaxfuuq';
> my $PASS = 'redacted';
> 
> my $SERVER = 'newsgroups.comcast.net';
> my $PORT = 119;
> 
> my $c = new Net::NNTP($SERVER, $PORT) or die $!;
> $c->authinfo($USER,$PASS) or die $!;
> 
> $nntp->group('comp.lang.perl.misc')
>    or die "failed to set group c.l.p.m.\n";
> my $msg_ids_ref = $nntp->newnews(time() - 24*60*60);
> die "Failed to retrieve message ids\n" unless @{$msg_ids_ref};
> 
> open my $ofh, '>', 'articles.txt'
>    or die "Cannot open articles.txt: $!";
> for my $msg_id (@{$msg_ids_ref}) {
>    $nntp->article($msg_id, $ofh)
>       or die "Failed to retrieve article $msg_id\n";
> }
> close $ofh;
> __END__
> I keep on trying this to make this script to run, without success.  I think 
> I'm making some headway on it though.  Instead of a grab bag of errors, 
> perl.exe is telling me that I have "an invalid argument" on this line:
> my $c = new Net::NNTP($SERVER, $PORT) or die $!;
> It takes a couple seconds for it to tell me that, so I think it might be 
> almost there.  Ideas?  Thanks in advance.

Well, did you bother to read the documentation for the Net::NNTP module? 
  If you do so, you will find you are calling the constructor 
incorrectly.  Also, you have already called the constructor once already 
at that point (but without checking for success), so why are you calling 
it again?  Then you go on to not use the second constructor call anyway???

BTW, when I comment out the second constructor call and the line after 
it that references it, your script otherwise verbatim generates a file 
called "articles.txt" with the past day's clpm articles in it, which I 
presume is what you want to do.
-- 
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl


------------------------------

Date: Wed, 4 Jul 2007 21:23:13 -0400
From: "Wade Ward" <invalid@invalid.nyet>
Subject: Re: retrieving news messages
Message-Id: <VsCdnSIETZ_c1RHbnZ2dnUVZ_tKjnZ2d@comcast.com>


"Bob Walton" <see.sig@rochester.rr.com> wrote in message 
news:468c3cdb$0$16577$4c368faf@roadrunner.com...
> Wade Ward wrote:

> Well, did you bother to read the documentation for the Net::NNTP module? 
> If you do so, you will find you are calling the constructor incorrectly. 
> Also, you have already called the constructor once already at that point 
> (but without checking for success), so why are you calling it again?  Then 
> you go on to not use the second constructor call anyway???
It would seem that I don't really know what a constructor is in perl without 
reading up on it.  _Programming Perl_ shows four different ways to invoke 
constructors.  Apparently the "my" is an lvalue modifier.  Do I now have it 
correct?
my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1} );

> BTW, when I comment out the second constructor call and the line after it 
> that references it, your script otherwise verbatim generates a file called 
> "articles.txt" with the past day's clpm articles in it, which I presume is 
> what you want to do.
Then it sounds like I'm getting close.  I'm still uncertain whether I have 
to use authinfo or not.  Right now, I have it commented out and perl.exe 
tells me that it can't call method "group" on an undefined value here:
$nntp->group('comp.lang.perl.misc')

#!/usr/bin/env perl
use strict;
use warnings;
use Net::NNTP;

my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1} );
my $USER = 'zaxfuuq';
my $PASS = 'redacted';
my $SERVER = 'newsgroups.comcast.net';
my $PORT = 119;

#$nntp->authinfo($USER,$PASS) or die $!;
$nntp->group('comp.lang.perl.misc')
   or die "failed to set group c.l.p.m.\n";
my $msg_ids_ref = $nntp->newnews(time() - 24*60*60);
die "Failed to retrieve message ids\n" unless @{$msg_ids_ref};

open my $ofh, '>', 'articles.txt'
   or die "Cannot open articles.txt: $!";
for my $msg_id (@{$msg_ids_ref}) {
   $nntp->article($msg_id, $ofh)
      or die "Failed to retrieve article $msg_id\n";
}
close $ofh;
__END__
The authors of _Programming Perl_ are jokers.  They have the three great 
virtues of a programmer as laziness, impatience and hubris.  I should fit 
right in.
-- 
WW




------------------------------

Date: Wed, 4 Jul 2007 21:33:12 -0500
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: retrieving news messages
Message-Id: <slrnf8om38.48n.tadmc@tadmc30.sbcglobal.net>

Wade Ward <invalid@invalid.nyet> wrote:

> It would seem that I don't really know what a constructor is in perl without 
> reading up on it.


Do you know what a constructor is in any other programming language?

It is the same thing in Perl, it creates a new instance (object).


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Thu, 05 Jul 2007 00:05:47 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: retrieving news messages
Message-Id: <m2tzsj8pgk.fsf@dot-app.org>

Tad McClellan <tadmc@seesig.invalid> writes:

> Do you know what a constructor is in any other programming language?
>
> It is the same thing in Perl, it creates a new instance (object).

It's conceptually the same, but there are a few potential "gotchas" for
someone who's accustomed to other languages. In C++ and Java, for example,
"new" is a keyword, and the constructor method must share the name of the
class it belongs to.

By contrast, Perl constructors have no restrictions placed on their name
beyond those placed on function and method names in general. new() is used
often, but it's not required - the constructor could just as well be named
make_a_widget(). Nor is new() required to be a constructor - although you'd
seriously confuse people if you used it for something else.

(I know this isn't new to you Tad, I figured it was worth expanding on it
a bit for the OP's benefit.)

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


------------------------------

Date: Thu, 05 Jul 2007 09:14:53 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: retrieving news messages
Message-Id: <ba5p83do19lsb9tuh1faa16kp9mj27umb8@4ax.com>

On Wed, 4 Jul 2007 21:23:13 -0400, "Wade Ward" <invalid@invalid.nyet>
wrote:

>Then it sounds like I'm getting close.  I'm still uncertain whether I have 
>to use authinfo or not.  Right now, I have it commented out and perl.exe 

That depends solely on whether you need to use authinfo to log in to
your news server when using your regular client or not.

>tells me that it can't call method "group" on an undefined value here:
>$nntp->group('comp.lang.perl.misc')

Because the constructor fails. As of how not to make it fail... I
don't know. In fact I've tried the script myself, changing the news
server with mine, which doesn't require authorization. I can't seem to
make the constructor succeed. Of course I can die() there, but it
baffles me that even with Debug => 1 no additional info is given. I'd
like to know *why* it fails but N::N's UI seems not to provide this
info.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


------------------------------

Date: Thu, 05 Jul 2007 12:25:20 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: retrieving news messages
Message-Id: <7vKdnQay0Jo82BDbnZ2dnUVZ_qKqnZ2d@comcast.com>

Wade Ward wrote:
> Right now, I have it commented out and perl.exe 
> tells me that it can't call method "group" on an undefined value here:
> $nntp->group('comp.lang.perl.misc')

Of course!  If $nntp is undef, there is no possible way that $nntp->group()
is going to work.  You are supposed to always check whether the constructor
was successfully created before attempting to use it.

   my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1} );
   die "Unable to create NNTP object" unless $nntp;

You have got to get those two statements working before proceeding
any further.
	-Joe



------------------------------

Date: Thu, 5 Jul 2007 17:25:51 -0400
From: "Wade Ward" <invalid@invalid.nyet>
Subject: Re: retrieving news messages
Message-Id: <io-dnSekFo-9_xDbnZ2dnUVZ_oqmnZ2d@comcast.com>


"Joe Smith" <joe@inwap.com> wrote in message 
news:7vKdnQay0Jo82BDbnZ2dnUVZ_qKqnZ2d@comcast.com...
> Wade Ward wrote:
>> Right now, I have it commented out and perl.exe tells me that it can't 
>> call method "group" on an undefined value here:
>> $nntp->group('comp.lang.perl.misc')
>
> Of course!  If $nntp is undef, there is no possible way that 
> $nntp->group()
> is going to work.  You are supposed to always check whether the 
> constructor
> was successfully created before attempting to use it.
Thanks for your reply.  Since this program is, for me and perl, the one 
directly after hello world, I'm unable to do a lot of things that I could 
with other syntaxes.

>   my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1} );
>   die "Unable to create NNTP object" unless $nntp;
>
> You have got to get those two statements working before proceeding
> any further.
Paul Lalli gave me this syntax for the constructor:
my $nntp = Net::NNTP->new('news.example.com', { Debug => 1} );
, and Bob Walton got it to work.  The only thing it looks like you could 
screw up is pasting in your news server.  I've looked at OE and 
newsgroups.comcast.net is how my other progs get news.  Could this have 
something to do with a comcast issue?
-- 
WW 




------------------------------

Date: Thu, 5 Jul 2007 17:32:21 -0400
From: "Wade Ward" <invalid@invalid.nyet>
Subject: Re: retrieving news messages
Message-Id: <ob2dnSDsz5A6_hDbnZ2dnUVZ_r2onZ2d@comcast.com>


"Tad McClellan" <tadmc@seesig.invalid> wrote in message 
news:slrnf8om38.48n.tadmc@tadmc30.sbcglobal.net...
> Wade Ward <invalid@invalid.nyet> wrote:
>
>> It would seem that I don't really know what a constructor is in perl 
>> without
>> reading up on it.
>
>
> Do you know what a constructor is in any other programming language?
>
> It is the same thing in Perl, it creates a new instance (object).
To the extent that I know what a constructor is, I have it from MFC.  It was 
all integrated with the IDE, and if you wanted a method, you get it with 
right-clicking and have the code stubouts waiting for you.  With perl, I'm 
operating off the command line and haven't even figured out how to get 
perl.exe's objections into a text file.
-- 
Wade Ward 




------------------------------

Date: Fri, 06 Jul 2007 02:37:46 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: retrieving news messages
Message-Id: <5f5hcoF3bnq2gU1@mid.individual.net>

Joe Smith wrote:
> You are supposed to always check whether the constructor
> was successfully created before attempting to use it.
> 
>   my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1} );
>   die "Unable to create NNTP object" unless $nntp;

Yes, but that check should better include an investigation of the 
contents of $!.

C:\home>type test.pl
#!/usr/bin/perl
use strict;
use warnings;
use Net::NNTP;
my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1} )
  or die "Unable to create NNTP object: $!";

C:\home>test.pl
Unable to create NNTP object: Invalid argument at C:\home\test.pl line 5.

C:\home>

"Invalid argument". So, let's try with passing the Debug option as two 
scalars instead of a hash ref:

C:\home>type test.pl
#!/usr/bin/perl
use strict;
use warnings;
use Net::NNTP;
my $nntp = Net::NNTP->new('newsgroups.comcast.net', Debug => 1 )
  or die "Unable to create NNTP object: $!";

C:\home>test.pl
Net::NNTP>>> Net::NNTP(2.23)
Net::NNTP>>>   Net::Cmd(2.26)
Net::NNTP>>>     Exporter(5.58)
Net::NNTP>>>   IO::Socket::INET(1.27)
Net::NNTP>>>     IO::Socket(1.28)
Net::NNTP>>>       IO::Handle(1.24)
Net::NNTP=GLOB(0x1a310b4)<<< 200 News.GigaNews.Com
Net::NNTP=GLOB(0x1a310b4)>>> MODE READER
Net::NNTP=GLOB(0x1a310b4)<<< 480 authentication required
Net::NNTP=GLOB(0x1a310b4)>>> QUIT
Net::NNTP=GLOB(0x1a310b4)<<< 205 goodbye

C:\home>

That seemed to work. From that debug info, there is especially one thing 
that's interesting: "authentication required". It may or may not be due 
to the ISP through which I'm accessing the Internet...

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Fri, 06 Jul 2007 00:56:57 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: retrieving news messages
Message-Id: <slrnf8r3vu.ndd.tadmc@tadmc30.sbcglobal.net>

Wade Ward <invalid@invalid.nyet> wrote:

> With perl, I'm 
> operating off the command line and haven't even figured out how to get 
> perl.exe's objections into a text file.


   perl.exe my_perl_program 2>messages.txt


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


------------------------------

Date: Thu, 05 Jul 2007 20:14:14 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: retrieving news messages
Message-Id: <EY2dnbzigePpOBDbnZ2dnUVZ_t3inZ2d@comcast.com>

Wade Ward wrote:

> Could this have something to do with a comcast issue?

Could be. I am on Comcast, and I use news.comcast.net as the server name.


------------------------------

Date: Fri, 06 Jul 2007 01:50:12 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: retrieving news messages
Message-Id: <fK-dncppXqXWnxPbnZ2dnUVZ_sWdnZ2d@comcast.com>

Gunnar Hjalmarsson wrote:
> Joe Smith wrote:
>> You are supposed to always check whether the constructor
>> was successfully created before attempting to use it.
>>
>>   my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1} );
>>   die "Unable to create NNTP object" unless $nntp;
> 
> Yes, but that check should better include an investigation of the 
> contents of $!.

No - not appropriate.

        $!      If used numerically, yields the current value of the C "errno"
                variable, or in other words, if a system or library call fails,
                it sets this variable.

When an object constructor fails, $! pretty much has nothing to do with
what the module is complaining about.

	-Joe


------------------------------

Date: Fri, 06 Jul 2007 02:19:14 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: retrieving news messages
Message-Id: <1sqdnZAG0rqElBPbnZ2dnUVZ_qGjnZ2d@comcast.com>

Wade Ward wrote:

> my $USER = 'zaxfuuq';
> my $PASS = 'redacted';
> my $SERVER = 'newsgroups.comcast.net';

That's the wrong format for $USER.  Should be 'zaxfuuq@comcast.net'.

linux% cat nntp-test.pl
#!/usr/bin/env perl
use strict;
use warnings;
use Net::NNTP;
$|=1;

my $USER   = 'myusername@comcast.net';
my $PASSWD = 'mypassword';
my $SERVER = 'news.comcast.net';        # aka news.comcast.giganews.com
my $GROUP  = 'comp.lang.perl.misc';
my $FILE   = 'articles.txt';
my $DAYS   = 3;

my $nntp = Net::NNTP->new($SERVER, { Debug => 1} );
print "new($SERVER) returned $nntp\n";

print "authinfo($USER,***) ";
$_ = $nntp->authinfo($USER,$PASSWD) ? 'succeeded' : 'failed';
print "$_\n";

print "group($GROUP) ";
$_ = $nntp->group($GROUP) ? 'succeeded' : 'failed';
print "$_\n";

my $time = time() - $DAYS*24*60*60;
print "Looking for articles since ".localtime($time)."\n";
my $msg_ids_ref = $nntp->newnews($time);
die "Failed to retrieve message ids\n" unless $msg_ids_ref;

open my $ofh, '>', $FILE
    or die "Cannot open $FILE: $!";
for my $msg_id (@{$msg_ids_ref}) {
    $nntp->article($msg_id, $ofh)
       or die "Failed to retrieve article $msg_id\n";
}
close $ofh;

linux% perl nntp-test.pl
new(news.comcast.net) returned Net::NNTP=GLOB(0x980a010)
authinfo(chezinwap@comcast.net,***) succeeded
group(comp.lang.perl.misc) succeeded
Looking for articles since Tue Jul  3 02:14:28 2007
Failed to retrieve message ids

		-Joe


------------------------------

Date: Fri, 06 Jul 2007 11:18:35 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: retrieving news messages
Message-Id: <5f6ft8F3andfeU1@mid.individual.net>

Joe Smith wrote:
> Gunnar Hjalmarsson wrote:
>> Joe Smith wrote:
>>> You are supposed to always check whether the constructor
>>> was successfully created before attempting to use it.
>>>
>>>   my $nntp = Net::NNTP->new('newsgroups.comcast.net', { Debug => 1} );
>>>   die "Unable to create NNTP object" unless $nntp;
>>
>> Yes, but that check should better include an investigation of the 
>> contents of $!.
> 
> No - not appropriate.
> 
>        $!      If used numerically, yields the current value of the C 
> "errno"
>                variable, or in other words, if a system or library call 
> fails,
>                it sets this variable.
> 
> When an object constructor fails, $! pretty much has nothing to do with
> what the module is complaining about.

Well, appropriate or not, but in this case it seems to have helped me 
detect a problem that noone else has mentioned so far (the braces).

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl


------------------------------

Date: Wed, 04 Jul 2007 10:11:36 +0100
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: The Modernization of Emacs: terminology buffer and keybinding
Message-Id: <468b644e$0$5872$da0feed9@news.zen.co.uk>

Chris Barts wrote:
> blmblm@myrealbox.com <blmblm@myrealbox.com> wrote on Monday 25 June 2007
> 15:43 in comp.emacs <5ear80F36ga72U3@mid.individual.net>:
> 
> 
>>Eclipse has something that generates "import" statements with
>>a few keystrokes, and for me that's almost in the "killer app
>>[feature]" class.  
> 
> 
> This is a sign of a weak programming language, in my eyes: If you need
> keystroke macros to enter boilerplate, you REALLY need a language that
> allows you to package commonly-used idioms into macros. 

You might have misunderstood.

In the same way that in Perl we write
   use XML::LibXML;

In Java you write
   import javax.swing.JComboBox;

In the case of Java this is solely so that later on you can write
   JComboBox fooBox = new JComboBox(...);
instead of
   javax.swing.JComboBox fooBox = new javax.swing.JComboBox(...);


The feature in Eclipse to which I think blmblm refers is that you can 
just write
   JComboBox fooBox = new JComboBox(...);
then press Ctrl+O and Eclipse will try to find all the packages that 
contain a JComboBox class. If there is only one, Eclipse will insert the 
  appropriate import statement at the top of the file. If there is more 
than one, Eclipse will offer you a list to choose from and then insert 
an import statement for the package you selected.

This mechanism works for classes in third-party and your own packages as 
well as the standard Java class library.

So far as I can see, adding a macro facility to the language (as opposed 
to the IDE) wouldn't help with this. The import statements are neither 
boilerplate nor idiom in the senses I understand. The Java classes I've 
written each have fairly unique sets of import statements.

Having a system of namespaces that allow for concise naming of classes 
whilst preventing class-name clashes seems to me more like a strength 
than a weakness.

Of course, Java and Perl do have plenty of significant weaknesses. I'm 
not yet convinced that lack of a macro facility is one of them.


------------------------------

Date: 04 Jul 2007 13:34:58 +0200
From: Bjorn Borud <borud-news@borud.no>
Subject: Re: The Modernization of Emacs: terminology buffer and keybinding
Message-Id: <m33b048krh.fsf@borud.not>

[Ian Wilson <scobloke2@infotop.co.uk>]
| 
| You might have misunderstood.

when people use words like "powerful" or "weak" about programming
languages you can safely assume that the ensuing discussion will be
fruitless.

-Bjørn


------------------------------

Date: 4 Jul 2007 16:49:45 GMT
From: blmblm@myrealbox.com <blmblm@myrealbox.com>
Subject: Re: The Modernization of Emacs: terminology buffer and keybinding
Message-Id: <5f21d9F3avgi5U1@mid.individual.net>

In article <468b644e$0$5872$da0feed9@news.zen.co.uk>,
Ian Wilson  <scobloke2@infotop.co.uk> wrote:
> Chris Barts wrote:
> > blmblm@myrealbox.com <blmblm@myrealbox.com> wrote on Monday 25 June 2007
> > 15:43 in comp.emacs <5ear80F36ga72U3@mid.individual.net>:
> > 
> > 
> >>Eclipse has something that generates "import" statements with
> >>a few keystrokes, and for me that's almost in the "killer app
> >>[feature]" class.  
> > 
> > 
> > This is a sign of a weak programming language, in my eyes: If you need
> > keystroke macros to enter boilerplate, you REALLY need a language that
> > allows you to package commonly-used idioms into macros. 
> 
> You might have misunderstood.

Seems very possible -- and I'm starting to be curious about what 
Chris thought import statements were.

> In the same way that in Perl we write
>    use XML::LibXML;
> 
> In Java you write
>    import javax.swing.JComboBox;
> 
> In the case of Java this is solely so that later on you can write
>    JComboBox fooBox = new JComboBox(...);
> instead of
>    javax.swing.JComboBox fooBox = new javax.swing.JComboBox(...);
> 
> 
> The feature in Eclipse to which I think blmblm refers is that you can 
> just write
>    JComboBox fooBox = new JComboBox(...);
> then press Ctrl+O and Eclipse will try to find all the packages that 
> contain a JComboBox class. If there is only one, Eclipse will insert the 
>   appropriate import statement at the top of the file. If there is more 
> than one, Eclipse will offer you a list to choose from and then insert 
> an import statement for the package you selected.

Yup, that's the feature I meant, and you explained it better than
I did (in a post to comp.emacs and comp.lang.java.programmer only).

> This mechanism works for classes in third-party and your own packages as 
> well as the standard Java class library.
> 
> So far as I can see, adding a macro facility to the language (as opposed 
> to the IDE) wouldn't help with this. The import statements are neither 
> boilerplate nor idiom in the senses I understand. The Java classes I've 
> written each have fairly unique sets of import statements.
> 
> Having a system of namespaces that allow for concise naming of classes 
> whilst preventing class-name clashes seems to me more like a strength 
> than a weakness.
> 
> Of course, Java and Perl do have plenty of significant weaknesses. I'm 
> not yet convinced that lack of a macro facility is one of them.

-- 
B. L. Massingill
ObDisclaimer:  I don't speak for my employers; they return the favor.


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V11 Issue 625
**************************************


home help back first fref pref prev next nref lref last post