develooper Front page | perl.perl6.language | Postings from May 2001

Re: Apoc2 - <STDIN> concerns

From:
Larry Wall
Date:
May 11, 2001 09:42
Subject:
Re: Apoc2 - <STDIN> concerns
Message ID:
200105111637.JAA07209@kiev.wall.org
Dave Storrs writes:
: 	Hmmm...I see your point, but I think it depends on what you see as
: the operatee that 'x' is operating on.  If it's the string(s) produced by
: <>, then you're certainly right.  But if it is the act of iterating
: itself, then I think my suggestion is still valid.  And yes, I realize
: that the current behavior is always to act on the string, not the act of
: calling the function that produced the string, or whatever.  I just think
: that we could extend 'x' to have a general repetition meaning.

I think just patching one operator from verbal status to adverbial
status is not sufficiently general.  Perl 6 will support adverbs of
some sort or other, so if you want to modify how a particular operator
works, we'll have a more general way to do that.  Think of it as properties
on operators rather than on values.  A number of cases come to mind

    <$STDIN> MUMBLE 2			# read twice
    1 .. 100 MUMBLE 3			# count by threes
    `glob $x` MUMBLE "/bin/csh"		# modify pseudoquote

It has not yet been decided what form these MUMBLEs will take, or even
whether they should have the same form.  It may be that the "default"
adverbial MUMBLE is simply ":".  Which might cause the above to reduce
to:

    <$STDIN> : 2			# read twice
    1 .. 100 : 3			# count by threes
    `glob $x` : "/bin/csh"		# modify pseudoquote

Non-default adverbs might then be more qualified:

    1 .. 100 :where { ok($^) }

If repeat count weren't the default adverb for <>, then maybe you'd write:

    <$STDIN> :x 2

One could even imagine using colon as an optional indirect object
syntax disambiguator, analyzed as if the argument list were the default
adverb modifying the method call:

    print $HANDLE{$dest} : @args;

Although making : take a list on the right by default would be, er,
"interesting" from a precedence point of view.

So I'm still MUMBLEing about that for now.

Larry



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About