[32362] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3629 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 2 14:09:26 2012

Date: Fri, 2 Mar 2012 11:09:09 -0800 (PST)
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, 2 Mar 2012     Volume: 11 Number: 3629

Today's topics:
        $var = do { ... }? (Tim McDaniel)
    Re: $var = do { ... }? (Randal L. Schwartz)
    Re: $var = do { ... }? (Seymour J.)
    Re: $var = do { ... }? <ben@morrow.me.uk>
    Re: $var = do { ... }? (Tim McDaniel)
    Re: access to variable names inside subprocedure <cartercc@gmail.com>
    Re: access to variable names inside subprocedure <kiuhnm03.4t.yahoo.it>
        Best way to search for a string which has N% in a chara <pengyu.ut@gmail.com>
    Re: Best way to search for a string which has N% in a c <kiuhnm03.4t.yahoo.it>
    Re: Best way to search for a string which has N% in a c <glex_no-spam@qwest-spam-no.invalid>
    Re: Best way to search for a string which has N% in a c (Tim McDaniel)
    Re: given...when <kiuhnm03.4t.yahoo.it>
    Re: New Science Discovery: Perl Detractors Remain Idiot (Seymour J.)
    Re: New Science Discovery: Perl Detractors Remain Idiot <chiron613@gmail.com>
    Re: New Science Discovery: Perl Idiots Remain Idiots Af (Seymour J.)
    Re: New Science Discovery: Perl Idiots Remain Idiots Af <kiuhnm03.4t.yahoo.it>
    Re: New Science Discovery: Perl Idiots Remain Idiots Af <xahlee@gmail.com>
    Re: New Science Discovery: Perl Idiots Remain Idiots Af <chiron613@gmail.com>
    Re: references (4567890) <kiuhnm03.4t.yahoo.it>
    Re: references (4567890) <ben@morrow.me.uk>
    Re: references (4567890) (Tim McDaniel)
        www.prevayler.org anyone reimplement this in perl? <gavcomedy@gmail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 2 Mar 2012 17:15:25 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: $var = do { ... }?
Message-Id: <jiqv7d$6k4$1@reader1.panix.com>

I just had a case where there's a block of code, I split up the work
into assignments to intermediate variables, but I only wanted the
final value.  I very much like to restrict the scope of variables,
because it's then obvious what's a temporary and what has more
significance -- it's like an intermediate stage between inline code
and a sub.  How I coded it was

    my $permanent_variable;
    {
        my $this = ...;
        my $that = ... $this ...;
        yadda yadda;
        $permanent_variable = ... final computation ...;
    }

It occurred to me that I could code it as

    my $permanent_variable = do {
        my $this = ...;
        my $that = ... $this ...;
        yadda yadda;
        ... final computation ...;
    };

It does do the scope encapsulation that I like, and it makes it
vividly obvious that the block has one purpose, to set
$permanent_variable.

I looked thru the codebase at work and found a few instances of it.
But mostly "do" was used to implement a slurp function, or otherwise
to "local()" a variable for one statement or call.

For people who have looked at lots of different codebases: do people
think that

    $var = do { several statement; }

is just an odd construct?

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Fri, 02 Mar 2012 09:52:42 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: tmcd@panix.com
Subject: Re: $var = do { ... }?
Message-Id: <86ehtax53p.fsf@red.stonehenge.com>

>>>>> "Tim" == Tim McDaniel <tmcd@panix.com> writes:

Tim> I looked thru the codebase at work and found a few instances of it.
Tim> But mostly "do" was used to implement a slurp function, or otherwise
Tim> to "local()" a variable for one statement or call.

I do that all the time, although it often suggests that what I really
have is a subroutine, and I should pull it out and make it one.

Tim> For people who have looked at lots of different codebases: do people
Tim> think that

Tim>     $var = do { several statement; }

Bear in mind that do { } is an expression, so you'll typically need a
semicolon after that before the next statement (common mistake).

print "Just another Perl hacker,"; # the original

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion


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

Date: Fri, 02 Mar 2012 13:42:41 -0500
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: $var = do { ... }?
Message-Id: <4f5114a1$1$fuzhry+tra$mr2ice@news.patriot.net>

In <jiqv7d$6k4$1@reader1.panix.com>, on 03/02/2012
   at 05:15 PM, tmcd@panix.com (Tim McDaniel) said:

>For people who have looked at lots of different codebases: do people
>think that

>    $var = do { several statement; }

>is just an odd construct?

No, as long as you get the syntax right. If it's the clearest way to
express your intent, then go for it.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

Date: Fri, 2 Mar 2012 18:44:01 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: $var = do { ... }?
Message-Id: <h0h729-r9e1.ln1@anubis.morrow.me.uk>


Quoth tmcd@panix.com:
> 
>     my $permanent_variable = do {
>         my $this = ...;
>         my $that = ... $this ...;
>         yadda yadda;
>         ... final computation ...;
>     };
> 
> It does do the scope encapsulation that I like, and it makes it
> vividly obvious that the block has one purpose, to set
> $permanent_variable.

I agree with Randal on both counts: I use do like this all the time, and
you should seriously consider making the block a sub instead.

> I looked thru the codebase at work and found a few instances of it.
> But mostly "do" was used to implement a slurp function,

If you mean the

    my $txt = do {
        open my $F, "<", ...;
        local $/;
        <$F>;
    };

construction then this is exactly the same situation, isn't it?

> For people who have looked at lots of different codebases: do people
> think that
> 
>     $var = do { several statement; }
> 
> is just an odd construct?

No. It's what do {} is there for...

Ben



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

Date: Fri, 2 Mar 2012 19:00:56 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: $var = do { ... }?
Message-Id: <jir5d8$lv5$1@reader1.panix.com>

In article <h0h729-r9e1.ln1@anubis.morrow.me.uk>,
Ben Morrow  <ben@morrow.me.uk> wrote:
>I agree with Randal on both counts: I use do like this all the time,
>and you should seriously consider making the block a sub instead.

Yeah, I tend to do too much inline code and end up with (for example)
300-line blocks of code.  You know, though, that it can be annoying to
subify something when it has lots of external dependencies, whether
inputs or outputs.

>> I looked thru the codebase at work and found a few instances of it.
>> But mostly "do" was used to implement a slurp function,
>
>If you mean the
>
>    my $txt = do {
>        open my $F, "<", ...;
>        local $/;
>        <$F>;
>    };
>
>construction then this is exactly the same situation, isn't it?

If the *only* use of it is as
    ... = do {local $/; <HANDLE>};
or the vast majority of use, then it can just be viewed as an idiom
for one special task.  E.g., about the only time I use hash slices is
    my %table;
    @table{@array} = (1) x @array;
(though I'm reconsidering using instead
    my %table = map { $_ => 1 } @array;
).

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Fri, 2 Mar 2012 07:23:18 -0800 (PST)
From: ccc31807 <cartercc@gmail.com>
Subject: Re: access to variable names inside subprocedure
Message-Id: <dae46033-58b1-4d9f-a670-c24f68a4daa9@j5g2000yqm.googlegroups.com>

On Mar 1, 3:38=A0pm, Ben Morrow <b...@morrow.me.uk> wrote:
> but I can't see something like those first three lines without wanting
> to turn it into a loop.

In my current state of just-above-minimal competence, I try to
abstract the logic. I bought a copy of 'Higher Order Perl' a number of
years ago, and quite frankly found it beyond me at that time. After
having studied through about eight Lisp books, it makes more sense,
but it's still hard work.

Over this period of time, I have had interesting and sometimes
acrimonious discussions with others, in person and on line, about the
fundamental distinction between code and data. I wrote a pretty big
web app a couple of years ago with the intention of processing code as
if it were data, and because of the way HTML is generated was able to
programatically  modify code to generate dynamic output based on the
input parameters. However, I'm still a novice at applying these
lessons in my day job. For what I do, this is often overkill, anyway.

I appreciate your comments.

CC.


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

Date: Fri, 02 Mar 2012 17:35:52 +0100
From: Kiuhnm <kiuhnm03.4t.yahoo.it>
Subject: Re: access to variable names inside subprocedure
Message-Id: <4f50f6e7$0$1380$4fafbaef@reader2.news.tin.it>

On 3/2/2012 16:23, ccc31807 wrote:
> On Mar 1, 3:38 pm, Ben Morrow<b...@morrow.me.uk>  wrote:
>> but I can't see something like those first three lines without wanting
>> to turn it into a loop.
>
> In my current state of just-above-minimal competence, I try to
> abstract the logic. I bought a copy of 'Higher Order Perl' a number of
> years ago, and quite frankly found it beyond me at that time. After
> having studied through about eight Lisp books, it makes more sense,
> but it's still hard work.

You should read the book
   "Concepts, Techniques, and Models of Computer Programming".

Kiuhnm


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

Date: Fri, 2 Mar 2012 08:29:24 -0800 (PST)
From: Peng Yu <pengyu.ut@gmail.com>
Subject: Best way to search for a string which has N% in a character class?
Message-Id: <672a6062-7397-4dae-852b-10a3a0728af9@n12g2000yqb.googlegroups.com>

Hi,

Suppose that I want to search for a substring which has say 50%
letters are in a letter class say [A-D]. Note that there is some
ambiguity at the two ends of the substring. But other than that, this
problem is well defined.

It seems that this problem can not (or can not easily, please let me
know if there is a way) be formulated in regex. Since perl is strong
in processing string, I think that there might be a good way to search
for such strings in perl. Does anybody have some good way in search
this type of substring?

Regards,
Peng


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

Date: Fri, 02 Mar 2012 18:25:10 +0100
From: Kiuhnm <kiuhnm03.4t.yahoo.it>
Subject: Re: Best way to search for a string which has N% in a character class?
Message-Id: <4f510275$0$1384$4fafbaef@reader2.news.tin.it>

On 3/2/2012 17:29, Peng Yu wrote:
> Suppose that I want to search for a substring which has say 50%
> letters are in a letter class say [A-D]. Note that there is some
> ambiguity at the two ends of the substring. But other than that, this
> problem is well defined.
>
> It seems that this problem can not (or can not easily, please let me
> know if there is a way) be formulated in regex.

/[A-D][^A-D]|[^A-D][A-D]/

Kiuhnm


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

Date: Fri, 02 Mar 2012 12:07:24 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Best way to search for a string which has N% in a character class?
Message-Id: <4f510c5c$0$75670$815e3792@news.qwest.net>

On 03/02/12 10:29, Peng Yu wrote:
> Hi,
>
> Suppose that I want to search for a substring which has say 50%
> letters are in a letter class say [A-D]. Note that there is some
> ambiguity at the two ends of the substring. But other than that, this
> problem is well defined.
>
> It seems that this problem can not (or can not easily, please let me
> know if there is a way) be formulated in regex. Since perl is strong
> in processing string, I think that there might be a good way to search
> for such strings in perl. Does anybody have some good way in search
> this type of substring?

What have you tried?????????????????

Using 'tr' and 'length' would probably help you.

 From perldoc perlop:

  y/SEARCHLIST/REPLACEMENTLIST/cds
     [...]Transliterates all occurrences of the characters found in the 
search list with the corresponding character in the replacement list. 
It returns the number of characters replaced or deleted.

Using that you can get the number of characters in the class.
e.g. $cnt = tr/[A-D]/[A-D]/;

Using 'length' you can find how many characters are in the string.

perldoc -f length

Divide one by the other, multiply by 100 and you have the percent.


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

Date: Fri, 2 Mar 2012 19:06:12 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: Best way to search for a string which has N% in a character class?
Message-Id: <jir5n4$lv5$2@reader1.panix.com>

In article <4f510c5c$0$75670$815e3792@news.qwest.net>,
J. Gleixner <glex_no-spam@qwest-spam-no.invalid> wrote:
>On 03/02/12 10:29, Peng Yu wrote:
>> Suppose that I want to search for a substring which has say 50%
>> letters are in a letter class say [A-D]. Note that there is some
>> ambiguity at the two ends of the substring. But other than that,
>> this problem is well defined.
>>
>> It seems that this problem can not (or can not easily, please let
>> me know if there is a way) be formulated in regex. Since perl is
>> strong in processing string, I think that there might be a good way
>> to search for such strings in perl. Does anybody have some good way
>> in search this type of substring?
>
>What have you tried?????????????????
>
>Using 'tr' and 'length' would probably help you.
>
> From perldoc perlop:
>
>  y/SEARCHLIST/REPLACEMENTLIST/cds
>     [...]Transliterates all occurrences of the characters found in the 
>search list with the corresponding character in the replacement list. 
>It returns the number of characters replaced or deleted.
>
>Using that you can get the number of characters in the class.
>e.g. $cnt = tr/[A-D]/[A-D]/;

"man perlop" continues

     Note that "tr" does not do regular expression character classes
     such as "\d" or "[:lower:]".  The <tr> operator is not equivalent
     to the tr(1) utility.  If you want to map strings between
     lower/upper cases, see "lc" in perlfunc and "uc" in perlfunc, and
     in general consider using the "s" operator if you need regular
     expressions.
                    
The expression
    tr/[A-D]/[A-D]/;
will translate [ to [ and ] to ], so they will be included in the
count.  A-D works because that's a special case in tr.  Also,

    If the "/d" modifier is used, the REPLACEMENTLIST is always
    interpreted exactly as specified.  Otherwise, if the
    REPLACEMENTLIST is shorter than the SEARCHLIST, the final
    character is replicated till it is long enough.  If the
    REPLACEMENTLIST is empty, the SEARCHLIST is replicated.  This
    latter is useful for counting characters in a class or for
    squashing character sequences in a class.

So if you really want a range of characters like A thru D,
    tr/A-D//
works.  If you want all digits, or all alphabetics, or some other
character class, you need to use s/// instead.

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Fri, 02 Mar 2012 13:19:44 +0100
From: Kiuhnm <kiuhnm03.4t.yahoo.it>
Subject: Re: given...when
Message-Id: <4f50bade$0$1390$4fafbaef@reader2.news.tin.it>

On 3/1/2012 22:31, Willem wrote:
> Kiuhnm wrote:
> ) On 3/1/2012 17:27, Willem wrote:
> )>  Kiuhnm wrote:
> )>  ) On 2/28/2012 20:38, Shmuel (Seymour J.) Metz wrote:
> )>  )>   Another poster gave what, IMHO, was a sound reason for the practice;
> )>  )>   if you add a line you need a separating semicolon, but you don't want,
> )>  )>   e.g., diff, to treat the original line as changed. Of course, you
> )>  )>   could add a semicolon on a separate line, but that would generally be
> )>  )>   poor style.
> )>  )
> )>  ) I understand, but why not using a smarter tool?
> )>
> )>  Can you name such a tool?
> )>  More specifically, one that is suitable for source control?
> )
> ) No, because I don't use any.
>
> Then I must assume such a 'smarter tool' does not exist,

Why?

> which answers your question.

Once diff didn't exist either.

Kiuhnm


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

Date: Fri, 02 Mar 2012 10:53:30 -0500
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: New Science Discovery: Perl Detractors Remain Idiots After A Decade!
Message-Id: <4f50ecfa$2$fuzhry+tra$mr2ice@news.patriot.net>

In <OD44r.17949$vo2.12949@newsfe07.iad>, on 03/02/2012
   at 02:17 PM, Chiron <chiron613@gmail.com> said:

>What always gets me is how so many people criticized Sokal for doing
>it, 

Google for Omerta. It's common for whistle blowers to be chastised or
even persecuted. I agree that the criticism of Prof Sokal was
outrageous, but it was also predictable.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

Date: Fri, 02 Mar 2012 19:06:06 GMT
From: Chiron <chiron613@gmail.com>
Subject: Re: New Science Discovery: Perl Detractors Remain Idiots After A Decade!
Message-Id: <yS84r.3100$wf.2643@newsfe09.iad>

On Fri, 02 Mar 2012 10:53:30 -0500, Shmuel (Seymour J.) Metz wrote:

> In <OD44r.17949$vo2.12949@newsfe07.iad>, on 03/02/2012
>    at 02:17 PM, Chiron <chiron613@gmail.com> said:
> 
>>What always gets me is how so many people criticized Sokal for doing it,
> 
> Google for Omerta. It's common for whistle blowers to be chastised or
> even persecuted. I agree that the criticism of Prof Sokal was
> outrageous, but it was also predictable.

Yeah, omerta... I'm familiar with it.  Talk and you're dead, and they put 
a canary in your mouth (well, some folks do, anyway).

But of course you're right - it's a milder form of omerta.  It's just so 
misguided.  Kill the messenger.  Imprison the whistle-blower.



-- 
Imitation is the sincerest form of plagiarism.


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

Date: Thu, 01 Mar 2012 16:11:35 -0500
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af
Message-Id: <4f4fe607$4$fuzhry+tra$mr2ice@news.patriot.net>

In <87k4341j0l.fsf@sapphire.mobileactivedefense.com>, on 03/01/2012
   at 02:40 PM, Rainer Weikusat <rweikusat@mssgmbh.com> said:

>You obviously don't have any sense of humour.

Certainly I do; I laugh at pretentious loons with delusions of
adequacy.

-- 
Shmuel (Seymour J.) Metz, SysProg and JOAT  <http://patriot.net/~shmuel>

Unsolicited bulk E-mail subject to legal action.  I reserve the
right to publicly post or ridicule any abusive E-mail.  Reply to
domain Patriot dot net user shmuel+news to contact me.  Do not
reply to spamtrap@library.lspace.org



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

Date: Fri, 02 Mar 2012 15:15:08 +0100
From: Kiuhnm <kiuhnm03.4t.yahoo.it>
Subject: Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!
Message-Id: <4f50d5ea$0$1383$4fafbaef@reader2.news.tin.it>

On 3/2/2012 14:12, Xah Lee wrote:
> On Mar 1, 3:00 am, Kiuhnm<kiuhnm03.4t.yahoo.it>  wrote:
>> They did not make up the terminology, if that is what you are saying.
>> The concepts of left and right associativity are well-known and accepted
>> in TCS (Theoretical CS).
>
>
>> Aho, Sethi and Ullman explain it this way in "Compilers: Principles,
>> Techniques and Tools":
>> "We say that the operator + associates to the left because an operand
>> with plus signs on both sides of it is taken by the operator to its
>> left. [...]"
>> And they also show parse trees similar to the ones I wrote above.
>
> how do they explain when 2 operators are adjacent e.g. 「3 △ 6 ▲ 5 」?

The same way you do, I guess. An operand that has operators on both 
sides is operand of the operator of higher precedence.
For instance, in
   3 * 4 + 6
4 is operand of * but not of +.
Indeed, the operands of + are 3*4 and 6.

> do you happen to know some site that shows the relevant page i can
> have a look?

Nope, sorry.

Kiuhnm


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

Date: Fri, 2 Mar 2012 05:12:20 -0800 (PST)
From: Xah Lee <xahlee@gmail.com>
Subject: Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!
Message-Id: <c17131d9-ccd8-46a3-bb57-02b844faad6b@qb4g2000pbb.googlegroups.com>

On Mar 1, 3:00=C2=A0am, Kiuhnm <kiuhnm03.4t.yahoo.it> wrote:
> They did not make up the terminology, if that is what you are saying.
> The concepts of left and right associativity are well-known and accepted
> in TCS (Theoretical CS).


> Aho, Sethi and Ullman explain it this way in "Compilers: Principles,
> Techniques and Tools":
> "We say that the operator + associates to the left because an operand
> with plus signs on both sides of it is taken by the operator to its
> left. [...]"
> And they also show parse trees similar to the ones I wrote above.

how do they explain when 2 operators are adjacent e.g. =E3=80=8C3 =E2=96=B3=
 6 =E2=96=B2 5 =E3=80=8D?

do you happen to know some site that shows the relevant page i can
have a look?

thanks.

 Xah

On Mar 1, 3:00=C2=A0am, Kiuhnm <kiuhnm03.4t.yahoo.it> wrote:
> On 3/1/2012 1:02, Xah Lee wrote:
>
> > i missed a point in my original post. That is, when the same operator
> > are adjacent. e.g. =E3=80=8C3 =E2=96=B2 6 =E2=96=B2 5=E3=80=8D.
>
> > This is pointed out by Kiuhnm =E3=80=94kiuhnm03.4t.yahoo.it=E3=80=95 an=
d Tim Bradshaw.
> > Thanks.
>
> > though, i disagree the way they expressed it, or any sense this is
> > different from math.
>
> They did not make up the terminology, if that is what you are saying.
> The concepts of left and right associativity are well-known and accepted
> in TCS (Theoretical CS).
>
> If you change the terminology, no one will understand you unless you
> provide your definitions every time (and then they may not accept them).
>
> Another way of saying that an operator is left-associative is that its
> parse tree is a left-tree, i.e. a complete tree where each right child
> is a leaf.
> For instance, (use a monospaced font)
> =C2=A0 =C2=A01 + 2 + 3 + 4
> gives you this left-tree:
> =C2=A0 =C2=A0 =C2=A0 =C2=A0+
> =C2=A0 =C2=A0 =C2=A0+ =C2=A0 4
> =C2=A0 =C2=A0+ =C2=A0 3
> =C2=A0 1 2
> while 1**2**3**4
> gives you this right-tree:
> =C2=A0 =C2=A0**
> 1 =C2=A0 =C2=A0**
> =C2=A0 =C2=A0 2 =C2=A0 =C2=A0**
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 3 =C2=A04
>
> Aho, Sethi and Ullman explain it this way in "Compilers: Principles,
> Techniques and Tools":
> "We say that the operator + associates to the left because an operand
> with plus signs on both sides of it is taken by the operator to its
> left. [...]"
> And they also show parse trees similar to the ones I wrote above.
>
> Kiuhnm


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

Date: Fri, 02 Mar 2012 14:17:18 GMT
From: Chiron <chiron613@gmail.com>
Subject: Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af
Message-Id: <OD44r.17949$vo2.12949@newsfe07.iad>

On Thu, 01 Mar 2012 10:13:11 -0500, Shmuel (Seymour J.) Metz wrote:

> In <DuD3r.21706$cL.12835@newsfe17.iad>, on 03/01/2012
>    at 05:07 AM, Chiron <chiron613@gmail.com> said:
> 
>>Hmm... maybe, instead of just ridiculing him,
> 
> I'm treating him as he treats others.

OK.
> 
>>BTW, I happen to agree with you insofar as this poster not understanding
>> the nature of mathematics.  His comment reminds me of the article, 
>>"Transgressing the Boundaries: Towards a Transformative Hermeneutics of
>>Quantum Gravity"
> 
> A brilliant piece of work. I greatly enjoyed it and the reaction to its
> disclosure.

What always gets me is how so many people criticized Sokal for doing it, 
instead of soundly condemning the editor for not bothering to verify what 
Sokal said.  It's like the kid points out that the emperor has no 
clothes, so they shoot the kid.  Of course, in real life, that's exactly 
what would happen, so I guess I shouldn't be too surprised...



-- 
It is a hard matter, my fellow citizens, to argue with the belly,
since it has no ears.
		-- Marcus Porcius Cato


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

Date: Fri, 02 Mar 2012 15:25:36 +0100
From: Kiuhnm <kiuhnm03.4t.yahoo.it>
Subject: Re: references (4567890)
Message-Id: <4f50d85e$0$1390$4fafbaef@reader2.news.tin.it>

On 3/1/2012 21:48, Ben Morrow wrote:
> Quoth Kiuhnm<kiuhnm03.4t.yahoo.it>:
>> Is there any good reason (why) we can't write
>>     ref->[0][1] instead of $ref->[0][1]
>
> That parses as
>
>      ref($_)->[0][1]
>
> and if you don't use a reserved word it parses as one of
>
>      "foo"->[0][1]
> or  foo()->[0][1]
>
> depending on whether there is a 'sub foo' in scope. The former is a
> symref (it's equivalent to ${"foo"}[0][1]) and will cause an error under
> strict "refs".

I can't find anything about symrefs. Do you have any links?

>> and, above all,
>>     @ref->[0][1] instead of @{$ref->[0][1]}
>> ?
>
> I did up a patch for perl at one point that made
>
>      $ref->[0][1][]

That's not a very short short-cut.
I can see no ambiguity in
   @ref->[0][1]
because
   @{ref}->[0][1] and
   @{ref->[0]}[1]
are nonsense.
Or, if want, @$ref->[0][1].

Kiuhnm


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

Date: Fri, 2 Mar 2012 16:05:39 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: references (4567890)
Message-Id: <jn7729-5791.ln1@anubis.morrow.me.uk>


Quoth Kiuhnm <kiuhnm03.4t.yahoo.it>:
> On 3/1/2012 21:48, Ben Morrow wrote:
> > Quoth Kiuhnm<kiuhnm03.4t.yahoo.it>:
> >> Is there any good reason (why) we can't write
<snip>
> >> and, above all,
> >>     @ref->[0][1] instead of @{$ref->[0][1]}
> >> ?
> >
> > I did up a patch for perl at one point that made
> >
> >      $ref->[0][1][]
> 
> That's not a very short short-cut.

No, it's not really a shortcut, but it seems a lot less awkward to me.
Having to wrap @{...} around a whole expression is rather ugly.

> I can see no ambiguity in
>    @ref->[0][1]
> because
>    @{ref}->[0][1] and
>    @{ref->[0]}[1]
> are nonsense.

Did you try it? That is currently valid (though deprecated) syntax,
equivalent to $ref[0][1]. 

(This was, I believe, a simple mistake in perl 5.000, which hasn't been
finally removed yet since people may be depending on it.)

Also, is this supposed to deref $ref? That would be *enormously*
confusing, since $ref isn't visibly part of the expression. @ref ->
$ref[0] is bad enough, adding $ref -> @ref->[0] at this point would be
silly.

> Or, if want, @$ref->[0][1].

That I could live with: you've effectively just changed the precedence
ot @{} to be lower than ->. Since it is currently valid syntax it would
take a while to get into a published version of perl. Current releases
already have mandatory deprecation warnings, so that step's happened,
but there would need to be at least one major release having it as a
syntax error before reintroducing it as new syntax.

If you want to do up a core patch, feel free. If you need advice, I have
some familiarity with the relevant bits of the core.

Ben



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

Date: Fri, 2 Mar 2012 17:19:30 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: Re: references (4567890)
Message-Id: <jiqvf2$6k4$2@reader1.panix.com>

In article <4f50d85e$0$1390$4fafbaef@reader2.news.tin.it>,
Kiuhnm  <kiuhnm03.4t.yahoo.it> wrote:
>I can see no ambiguity in
>   @ref->[0][1]
>because
>   @{ref}->[0][1] and
>   @{ref->[0]}[1]
>are nonsense.

I dislike the notation because $ref is always referred to by $ref
everywhere ... except in this syntax.

In fact, I did want a "ref slice" a few days ago.  I had an array of
refs and I wanted the ID key out of all of them.  I wanted to do
    @arr->{ID}
but Perl doesn't allow that; I had to code it more verbosely as
    map { $_->{ID} } @arr

-- 
Tim McDaniel, tmcd@panix.com


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

Date: Fri, 2 Mar 2012 10:58:23 -0800 (PST)
From: gavino <gavcomedy@gmail.com>
Subject: www.prevayler.org anyone reimplement this in perl?
Message-Id: <33030455.6.1330714703548.JavaMail.geo-discussion-forums@pbcpv4>

seems a game changer, obsolete postgrersql, which already obsoletes oracle


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

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:

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

Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests. 

#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 3629
***************************************


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