Why isn't void context a 'real' context

F

Florian Kaufmann

Hello

My copy of "Programming Perl" is telling me in Chapter 2/Context/Void
Context (and in other text parts nearby) that scalar- and list
contexts are the only real contexts. However, since wantarray lets me
distinguish between list, scalar and void context, I also can overload
my own subroutines 3 times: Depending on the 3 return values of
wantarray, I can let behave my subroutine 3 different ways, i.e.
overload it 3 times.
I assume that its just that Perl guarantees me that its builtin
operations are only overloaded in respect to scalar and list context;
never to void context?

Greetings

Flo
 
R

Randal L. Schwartz

Florian> I assume that its just that Perl guarantees me that its builtin
Florian> operations are only overloaded in respect to scalar and list context;
Florian> never to void context?

I believe that in recent changes to Perl, void context is now noticed. For
example, map/grep in a void context no longer builds the result list.
The ultimate authority for this is, of course, the source code.

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

Tad J McClellan

Pinocchio said:
NO, you asshole. Larry Wall is the original Perl hacker.


As with most comments in code, it refers to the code, not to the coder.

The quoted code _is_ the original JAPH.


[ snip ]

And who are you?

An anonymous coward.

Everybody here knows how much weight that carries.

Charlton Wilbur
John Bokma
Paul Lalli
Jürgen Exner
Tad McClellan
A. Sinan Unur a.k.a. A.Sinine
Michele Dondi
Uri Guttman a.k.a. Urine Buttman
Sherman Pendley


All of those people have the balls to post under their names.

Are you an eunuch, or do you just want to become a real boy?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,231
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top