[32226] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3491 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 5 18:09:26 2011

Date: Mon, 5 Sep 2011 15:09:04 -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           Mon, 5 Sep 2011     Volume: 11 Number: 3491

Today's topics:
    Re: What to return in scalar context ? (Randal L. Schwartz)
    Re: What to return in scalar context ? <kst-u@mib.org>
    Re: Why does sort return undef in scalar context ? <willem@toad.stack.nl>
    Re: Why does sort return undef in scalar context ? <rweikusat@mssgmbh.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sun, 04 Sep 2011 06:30:05 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: What to return in scalar context ?
Message-Id: <8639gch1uq.fsf@red.stonehenge.com>

>>>>> "Ilya" == Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:

Ilya> If there are SEVERAL things which may be all EXPECTED to be
Ilya> "logically deducible" (possibly by DIFFERENT PEOPLE) - it was
Ilya> decided to be an "unwanted situation".  This is called "the
Ilya> principle of least surprise".

The actual answer is "whatever was most logical *to Larry*".  Any other
answer isn't paying attention to history.

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: Sun, 04 Sep 2011 21:23:04 -0700
From: Keith Thompson <kst-u@mib.org>
Subject: Re: What to return in scalar context ?
Message-Id: <ln39gbr51z.fsf@nuthaus.mib.org>

merlyn@stonehenge.com (Randal L. Schwartz) writes:
>>>>>> "Ilya" == Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:
> Ilya> If there are SEVERAL things which may be all EXPECTED to be
> Ilya> "logically deducible" (possibly by DIFFERENT PEOPLE) - it was
> Ilya> decided to be an "unwanted situation".  This is called "the
> Ilya> principle of least surprise".
>
> The actual answer is "whatever was most logical *to Larry*".  Any other
> answer isn't paying attention to history.

Sure, but if what was most logical to Larry happens to be consistent
with the principal that Ilya suggests, that's a good thing to know,
and a good rule of thumb for understanding why Perl is the way it is.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"


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

Date: Sun, 4 Sep 2011 15:09:58 +0000 (UTC)
From: Willem <willem@toad.stack.nl>
Subject: Re: Why does sort return undef in scalar context ?
Message-Id: <slrnj67566.1uq8.willem@toad.stack.nl>

Ted Zlatanov wrote:
) Specifically there is *no way* to get the sort-p information (boolean or
) float) without calling sort(), which is either stupid or wasteful
) depending on your point of view.  sort-p is useful on its own and
) merging it with the sort() scalar context is what I don't want.  So I
) think it's worth putting it in Perl 5 or 6 if that's not too difficult.

Can't you create it with the reduce() function in List::Util ?


SaSW, Willem
-- 
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !
#EOT


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

Date: Sun, 04 Sep 2011 18:56:36 +0100
From: Rainer Weikusat <rweikusat@mssgmbh.com>
Subject: Re: Why does sort return undef in scalar context ?
Message-Id: <87zkikkx7v.fsf@sapphire.mobileactivedefense.com>

Ilya Zakharevich <nospam-abuse@ilyaz.org> writes:
> On 2011-09-02, Rainer Weikusat <rweikusat@mssgmbh.com> wrote:
>> In order to be able to get anywhere here, it is first necessary to
>> have something which compiles a file with C source code such that it
>> will be compatible with perl. The following shellscript can be used
>> for that:
>
> IMO, the simplest way to experiment with C-to-Perl interface is

I'm not usually 'experimenting' with it, rather using it. The two
scripts I posted actually exist because I have a certain perl program
with some additional functions written in C which were too small and
specific to warrant putting them into a module (the same program also
uses several more elaborate extension modules written in C in order
to get access to various 'Linux interfaces' not otherwise available to
Perl code). 

>   a) Use h2xs with appropriate options to generate an "empty" XSUB
>      module named FOO;
>
>   b) Add some XSUB directives to the end of FOO/FOO.xs and testing
>      code to FOO/t/FOO.t;
>
>   c) run
> 	Makefile.PL
> 	make test
>      in ./FOO.
>
> (Or at least it was the simplest way 15 years ago.  Is there a simpler
> way now?)

Similar to these 'tiny functions', a single XS routine supposed to
demonstrate a specific property of perl hardly warrants creating a
complete extension module, especially not when it is supposed to be
part of a USENET posting as this would be rather unwieldy.

> Hope this helps,

Thanks for the effort, but I wasn't joking when I wrote that I have
been using Perl in all kinds of professional and non-professional
context since about 1996. And this included creating more than half a
dozen XS modules (the program/ product I mentioned uses six of them),
hacking the mod_perl code in order to fix a couple of bugs/ annoyances
with that and adding some more features to DBD::Pg (specifically,
complete support for the Postgres async interface, just done in a
way that I wouldn't want to publish it. But it works very nicely :-).

I'm also really clueless about lots of things I haven't ever dealt
with so far.



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

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 3491
***************************************


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