[13123] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 533 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 14 23:17:13 1999

Date: Sat, 14 Aug 1999 20:10:11 -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           Sat, 14 Aug 1999     Volume: 9 Number: 533

Today's topics:
    Re: Why use Perl when we've got Python?! (Abigail)
    Re: Why use Perl when we've got Python?! (Abigail)
    Re: Why use Perl when we've got Python?! <tchrist@mox.perl.com>
    Re: Why use Perl when we've got Python?! (Abigail)
    Re: Why use Perl when we've got Python?! (Abigail)
    Re: Why use Perl when we've got Python?! <tchrist@mox.perl.com>
    Re: Why use Perl when we've got Python?! (Kevin Reid)
    Re: Why use Perl when we've got Python?! bane_dewitt@my-deja.com
    Re: Why use Perl when we've got Python?! (Sam Holden)
    Re: Why use Perl when we've got Python?! (Sam Holden)
    Re: Why use Perl when we've got Python?! <uri@sysarch.com>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 14 Aug 1999 20:08:53 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rc4r6.a5.abigail@alexandra.delanet.com>

John W. Stevens (jstevens@basho.fc.hp.com) wrote on MMCLXXIII September
MCMXCIII in <URL:news:37B45761.AFBC0FCB@basho.fc.hp.com>:
|| 
|| On the other hand, Python encourages you to use the OO paradigm, and
|| the overhead implicit in message sends can *REALLY* slow down a program.


Perl's OO paradigm sucks. Perl's OO paradigm was taken from Python.
Draw your own conclusions about Python's OO paradigm from that.



Abigail
-- 
perl -wleprint -eqq-@{[ -eqw\\- -eJust -eanother -ePerl -eHacker -e\\-]}-


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 14 Aug 1999 20:13:23 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rc53i.a5.abigail@alexandra.delanet.com>

Kvan (kvan@dis.dk) wrote on MMCLXXII September MCMXCIII in
<URL:news:u907h5iz5.fsf@dis.dk>:
** 
** Yet, many C programmers actually use a Hungarian notation anyway. In
** perl it is enforced, and allows you to quickly judge the type of
** complex constructs (it's easy to tell that @{$foo->bar("snafu")} is an
** array, even without knowing a thing about the scalar $foo). This is,
** I'll admit, quite contrary to the TIMTOWTDI philosophy of Perl, but it
** works well.


So, $obj -> method () returns a scalar, right? And I call a method
returning a list with @obj -> method (), right? And closures returning
hashes are called like %closure -> (), right?



Abigail
-- 
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 14 Aug 1999 19:17:39 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b61533@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    abigail@delanet.com writes:
:So, $obj -> method () returns a scalar, right? And I call a method
:returning a list with @obj -> method (), right? And closures returning
:hashes are called like %closure -> (), right?

That doesn't even start to make sense.  The prefix deref binds more
tightly than the infix arrow.  When you want something else, you need
to specify grouping.

--tom
-- 
 "The tree of liberty must be watered periodically with the blood of tyrants
 and patriots alike.  It is its natural manure." --Thomas Jefferson


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

Date: 14 Aug 1999 20:18:27 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rc5d4.a5.abigail@alexandra.delanet.com>

John W. Stevens (jstevens@basho.fc.hp.com) wrote on MMCLXXIII September
MCMXCIII in <URL:news:37B45975.CFBFDE19@basho.fc.hp.com>:
[] 
[] Ok.  I'll take that challenge. . . create for me an unreadable
[] Python program that actually compiles and runs.


As soon as you create for me an unreadable Perl program that actually
compiles and runs.



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 14 Aug 1999 20:24:32 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rc5og.a5.abigail@alexandra.delanet.com>

John Stevens (jstevens@bamboo.verinet.com) wrote on MMCLXXIV September
MCMXCIII in <URL:news:slrn7r9q6l.h3c.jstevens@bamboo.verinet.com>:
[] 
[] Thank you.  I will.  Perl cannot be used without manuals.

Show me a language that can, and your statement might start to
carry weight. Otherwise, it's just pointless, hollow FUD.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'


  -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
   http://www.newsfeeds.com       The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including  Dedicated  Binaries Servers ==-----


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

Date: 14 Aug 1999 19:34:30 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b61926@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, abigail@delanet.com writes:

:perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
:.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
:.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
:%$^U;$^V/=$^U}while$^V!=$^W'

He'll probably try to use that against you, you know. :-)

--tom
-- 
Procedure names should reflect what they do; function names should reflect
what they return. --Rob Pike


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

Date: Sat, 14 Aug 1999 21:40:21 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <1dwjpso.1du39emucuni0N@imac.loc>

Uri Guttman <uri@sysarch.com> wrote:

> >>>>> "JS" == John Stevens <jstevens@bamboo.verinet.com> writes:
> 
>   JS> If it's a stack, it should only allow stack operations (push, pop).
> 
> so you write a closure to do that and no need for OO for something so
> simple.

Just for fun, I decided to write it:

#!perl -w

use constant PUSH => 1;
use constant POP => 0;

sub new_stack {
  my @stack;
  return sub {shift() ? (push @stack, @_) : (pop @stack)};
}

$s = new_stack();
$s->(PUSH, "Goodbye, world!\n");
$s->(PUSH, "Hello, world!\n");
print $s->(POP);
print $s->(POP);

__END__

Producing an error on stack underflow is left as an exercise for the
reader.

(BTW, after writing this, I'm thinking that this is actually an
interesting and possibly useful way of producing encapsulation without
having to write an object class.)

-- 
 Kevin Reid: |    Macintosh:      
  "I'm me."  | Think different.


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

Date: Sun, 15 Aug 1999 01:50:48 GMT
From: bane_dewitt@my-deja.com
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <7p56dl$hmv$1@nnrp1.deja.com>

In article <slrn7r9q6l.h3c.jstevens@bamboo.verinet.com>,
  jstevens@bamboo.verinet.com (John Stevens) wrote:

> Thank you.  I will.  Perl cannot be used without manuals.

LOL! When I got shoved into a webmaster job, I edited and
maintained all the form CGI perl code for two months before
I figured out where the documentation was.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: 15 Aug 1999 02:10:03 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rc8co.rsf.sholden@pgrad.cs.usyd.edu.au>

On Sat, 14 Aug 1999 12:06:11 +0100, Alex Maranda <amaranda@nospam.com> wrote:
>Sam Holden wrote: 
>> >
>> >>You can write Perl programs that resemble sed, or awk, or C, or Lisp, or
>> >>Python. This is Officially Okay in Perl culture.
>> >
>> >You cannot write Perl that resemble Python.  You are required to
>> >use curly braces as block delimiters.
>> 
>> In fact you are not. You are wrong yet again. Actually thinking about how
>> perl works for a minute would show you that perl is in fact flexible.
>> it is not a lie when people say perl doesn't force you to write a
>> particular way.

<snip impythonate.pm by Damian Conway>

>> And here is his sample code that is now valid perl (although anyone who uses
>> it for real code should be killed) :
>Why? You don't happen to hate Pythoneers or Python itself, do you? I've
>actually appreciated the argument from your second post, when you taxed
>the other guy for needlessly questioning your Python knowledge out of
>context.

I know a fair few pythoners in fact, I even like some of them. What I meant
was that anyone who would do such a thing with perl deserves to be killed.
Since no one else will be able to maintain the program. It's like someone
who starts a C program with :

#define BEGIN {
#define END }

Doing things like this means that a C programmer can't understand the code,
and a Pascal programmer can't either. With impythonate.pm, a perl
programmer can't understand the code, and a python programmer can't either.

Also don't tell anyone but I actually like python a lot. I don't use it much
since I have more experience with perl, and more importantly I know the
modules available for perl better, and can quickly search for one to
do whatever I need next.

>I am completely ignorant with Perl and I can barely read what's above
>(by interpolating my knowledge of shell, C, and Tcl).

That's because it uses a lot of the not so well known perl features. 

>
>> 
>> #Now newlines replace colons and indentation replaces brackets:
>> 
>> use impythonate; # STILL NEED THAT ONE SEMICOLON, DAMMIT!
>> 
>> for $i (1..10)  # COMMENTS ARE OKAY
>>   print "$i: "
>>   my $isq =  \
>>   $i **2 # LINE CONTINUATIONS WORK AS IN PYTHON
>>   print " $isq\n"
>> 
>> print "done\n"
>I know Python fairly well (but I'm no expert) and I can easily read this
>piece of Perl.

But it would be no harder to read with ; on the end of each statement and
a pair of {}s.

Working out that strings interpolate should be a bigger leap than working
out that blocks have {}s around them.

> Getting back to the killing part, which kind of disturbs
>me when reading comp.lang.python:
>- was that necessary to make a point?
>- if yes, what was the point?
>- if the point (just guessing) was that Perl code should never look like
>Python, isn't that against of 'there should be more ways of doing it?'

I answered this above a little.

It was necessary since I don't want someone actually using such an untested
module in their code. Chances are it breaks on many python constructs. The
obvious example is :

if (1==1) : print "fred"

It won't handle that.

Everyone seems to misunderstand the whole concept of TMTOWTDI. It doesn't
mean all ways are equal. That is a way of writing perl which works, it is
however not very maintanable. The only way to determine what syntax is
valid is to know perl's syntax, and to be able to read and understand the
impythonate.pm code - since there is no documentation and it is _not_ the
same as python.

Writing it in 'normal' perl reduces the requirements to understanding, and
speeds it up to boot.

>I fail to see the interesting part in this whole thread, which disturbs
>the habitat of comp.lang.python. I think John Stevens was mistaken to
>bring the discussion over to this newsgroup in the first place. We don't
>have strong feelings about Perl, and don't have plans for world
>domination or anything.
>
>A couple of days ago I read a bit in Bugzilla's README which amused me:
>"A computer which doesn't have Perl installed is a very sad computer
>indeed". Your post is frightening (unless it was a Perl-style joke).

How was it frightening?

If you want to program in python, then use python. It's a nice language,
it is portable, it is simple to install, it is easy to learn. 

So what is the point of munging another language to look like it? If you could
munge perl so that you could name the capturing elements of a regex then that
would be a useful, python like addition...

-- 
Sam

There's no such thing as a simple cache bug.
	--Rob Pike


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

Date: 15 Aug 1999 02:12:27 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rc8h8.rsf.sholden@pgrad.cs.usyd.edu.au>

On Sat, 14 Aug 1999 15:14:28 GMT,
    John Stevens <jstevens@bamboo.verinet.com> wrote:
>On Sat, 14 Aug 1999 12:06:11 +0100, Alex Maranda <amaranda@nospam.com> wrote:
>>Sam Holden wrote: 
>>Why? You don't happen to hate Pythoneers or Python itself, do you? I've
>>actually appreciated the argument from your second post, when you taxed
>>the other guy for needlessly questioning your Python knowledge out of
>>context.
>
>It was not out of context.
>
>Look at the Subject of this thread. . .

Read the content of my post, and learn how usenet wanders... I wasn't
arguing about the relative merits of perl and python. I don't care, I 
use both, hang I've used them both in the same system.

-- 
Sam

compiling kernels is what I do most, so they do tend to stick to the
cache ;)	--Linus Torvalds


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

Date: 14 Aug 1999 23:02:15 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <x74si14uh4.fsf@home.sysarch.com>

>>>>> "KR" == Kevin Reid <kpreid@ibm.net> writes:

  KR> Uri Guttman <uri@sysarch.com> wrote:
  >> so you write a closure to do that and no need for OO for something so
  >> simple.

  KR> Just for fun, I decided to write it:

  KR> sub new_stack {
  KR> my @stack;
  KR> return sub {shift() ? (push @stack, @_) : (pop @stack)};
  KR> }

  KR> $s = new_stack();
  KR> $s->(PUSH, "Goodbye, world!\n");
  KR> $s->(PUSH, "Hello, world!\n");
  KR> print $s->(POP);
  KR> print $s->(POP);

here was what i had in mind. similar but two closures and no op arg.

sub new_stack {
	my @stack;
	return ( sub { push @stack, @_ },
		 sub { pop @stack } ) ;
}

( $push, $pop ) = new_stack();
$push->( "Goodbye, world!\n" );
$push->( "Hello, world!\n" );
print $pop->();
print $pop->();

it would be easy to add error checking and size and other stack related
ops.

boy it is fun to make encapsulated stuff without objects!

uri


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.


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

Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 1 Jul 99)
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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu. 

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 V9 Issue 533
*************************************


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