>>>>> "Smylers" == Smylers <[EMAIL PROTECTED]> writes:
Smylers> No: no aliases. Perl does not have a tradition of these,
except "for"/"foreach". :)
But I agree with the rest of your position.
--
Randal L. Schwartz - Stoneh
ement as a true normal if/while instead of a backwards
if/while, and it *does* help the overall readability.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
Se
$foo" be called
"environmental variables", you're cruisin' for a world of hurt, and I say this
as someone who will have to document this and teach this to a group of newbies
for every week of my upcoming life.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc.
Please, let us agree to use the traditional name of "environment variables" in
the docs, and not re-introduce its bastardized cousin, which hurts my ears.
Thanks.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
http://www.stonehenge.com/merlyn/&
(let
me tell you how to sort two items), you'll still need a very perl5-ish
interface.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
ute (like maybe calling a database).
For these scenarios, specifying the sort comparison will be simpler
and cheaper than specifying the sort key.
So, we need both, but if we get only one, the Perl5 way is superior.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
http://
hat are used by that object as the execution platform varies.
This is similar to the OS-9's "gestalt" tables, which got smarter as
the operating system had more features, but was a consistent way to
ask "do we have a color monitor here?".
Is something like this already pl
>>>>> "Randal" == Randal L Schwartz writes:
Randal> For example, if I wanted the identity hash (where all values are 1,
Randal> but keys are original list elements), I could do:
Randal> my %hash = @somelist.inject({}, { $^a{$^b} = 1; $^a });
And yes, I k
ash = @somelist.inject({}, { $^a{$^b} = 1; $^a });
That'd be Way Cool. Once you get your head around inject, you never
want to go back to reduce. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulti
>>>>> "Larry" == Larry Wall <[EMAIL PROTECTED]> writes:
Larry> The shifts are all X< rather than X<< to avoid confusion with Texas
Quotes.
I've been staring too much at POD lately. I saw both of those as very
broken pod-start marks. :)
--
Ran
between /-as-divide
Matthew> and /-as-regex becomes much easier if lookahead is employed in the
Matthew> tokeniser.
No, not possible at all. The entire rest of the program may be valid
either way. You *must* know by the time you're done with /, or
/-and-more. The rest of the code cann
of the
regex to properly be a token).
Please see the referenced perlmonks article.
All the handwaving in the world won't fix this. As long as we have
dual-natured characters like /, and user-defined prototypes, Perl
cannot be lexed without also parsing, and therefore without also
running BEGI
lex a Perl program (Perl6 included), you *must* execute
BEGIN blocks. That's the end of that tune. Anything else is just an
approximation.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Un
tches would
Larry> then automatically be assumed to be in Perl 6.
Boy, when Larry says "I get the colon", he really had plans for it.
:-)
Perl8 will look like:
:: : : :: :: ::: :;
(note the semicolon line terminator, to be replaced by a
ng in modules, but
in 10 line scripts, they show up quite frequently.
This undermines the rest of your request.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing
>>>>> "Randal" == Randal L Schwartz <[EMAIL PROTECTED]> writes:
Randal> I actually consider that an annoying statement. I have to back up
Randal> three times to figure out what it means.
And before someone whips out the Schwartzian Transform to undermin
actually consider that an annoying statement. I have to back up
three times to figure out what it means.
I think Larry was on the right track here.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
used, and recognized immediately). But when people started
nesting them, the code became incredibly unreadable quickly, so
no-nesting for Perl was a deliberate choice, not an implementation
detail.
Unless Larry has come up with an overwhelming reason to permit them
after years of not having the
as much as is practically (and legally) possible.
Stonehenge has been a major contributor to YAS. I don't see why we
should start changing plans in midstream.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/mer
;t use it. Can someone give an example of an actual, proper, use?
It was to make "pass by reference" easier, before prototypes if I recall:
myfunc \($a, @b, %c);
which means the same as if we had said:
sub myfunc (\$ \@ \%);
myfunc($a, @b, %c);
Except that
foo[0-9][0-9] yields foo00, foo01, ...
Rich> I'm wondering whether Perl should have a similar capability, using REs.
Well, here's a cheap way:
my @list = glob ('foo{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}');
:-)
--
Randal L. Schwartz - Stonehenge Consulting Services,
>>>>> "Simon" == Simon Cozens <[EMAIL PROTECTED]> writes:
Simon> What were the good reasons for not allowing localized lexicals in Perl 5?
Nobody could explain it in 50 words or less.
"What the hell is 'local my $foo = 35'?"
--
Randal L
plate? I've already done a Scheme proof
pdcawley> of concept after all...
This is already a thread on perlmonks.org... see user "ovid".
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
I'd love to have it sooner rather than
David> later.
Not in 5.8, which is in the final freezy stages.
Perhaps in 5.9 thus 5.10.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix
> "Dan" == Dan Sugalski <[EMAIL PROTECTED]> writes:
Dan> (Or maybe attributed string eval, like:
Dan> $foo = eval.Parrot sub I0, I0, 5
Dan>EOP
That would make more sense to me (for whatever that's worth) as
$foo = Parrot.eval < http:
>>>>> "David" == David Whipp <[EMAIL PROTECTED]> writes:
David> If every object has a C method (C?), then you could
David> always call class-methods as class.m2().
Wouldn't that be .class.m2(), or did I miss something in the flurry?
--
Randal L. Schw
ology {
Piers> ... { $self.ish }
Piers> }
Piers> }
Piers> }
You could use the Smalltalk way by defining method myself in UNIVERSAL,
which simply returns self. So ".myself" would always be yourself,
which you could store if needed.
--
Randal L. Schwart
rue.
Maybe in the interest of huffman encoding, we could make it "even_though". :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
>>>>> "Damian" == Damian <[EMAIL PROTECTED]> writes:
Damian> @result = {block}^.(@data);
But "hyperdot sort hyperdot" doesn't roll off the tongue as easy as
"map sort map"!
:-)
--
Randal L. Schwartz - Stonehenge Consultin
>>>>> "Larry" == Larry Wall <[EMAIL PROTECTED]> writes:
Larry> @result = for @a; @b -> $a, $b { $a op $b }
Larry> (presuming we make C actually act like C).
Why not just make map do that?
--
Randal L. Schwartz - Stonehenge Consulting Services,
will have its own
PRE/POST, and then there's no need to inherit it. If you don't call
"super", how do you know the PRE/POST of a similar subroutine in a
superclass that you're completely overriding should even apply?
So, does it make any sense at all to talk about "
gel> Instead of
Angel> foreach @arr -> $item {...}
Larry considered that, and declined. Not sure of the reasons.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Tech
>>>>> "John" == John Siracusa <[EMAIL PROTECTED]> writes:
John> (Can I pre-order the Perl 6 Camel or what? ;)
Of course. You'll almost certainly visit the nodes before the subnodes
in the documentation.
:-)
--
Randal L. Schwartz - Stonehenge Cons
tains NaN.
Just think of it as a quantum number that hasn't collapsed. :)
"No two NaNs are alike!"
Read it as "one of many non-numbers, chosen at random".
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http
is().$next() } };
Damian> }
Damian> }
Right? Plus or minus a set of parens or something, eh?
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
uot;$x, $y, $z\n" if $x**2 == $y**2 + $z**2;
Damian> }}}
Damian> is much cleaner.
Or even
for my $x (1..98) {
for my $y (1..(99-$x)) {
for my $z (1..(100-$x-$y)) {
print "$x, $y, $z\n" if $x ** 2 = $y ** 2 + $z ** 2;
}
}
}
Damian>
you wrote { EXPR; EXPR; EXPR; }.
This seems to be the most natural approach. Define statement as
expression followed by semicolon. Don't try to take the Pascal approach
of "semicolon is statement separator". Take the *C* approach.
--
Randal L. Schwartz - Stonehenge Consulti
onal concepts. An anon
sub is not necessarily a closure. A closure is not necessarily an
anon sub. Unfortunately, there were some casual misuses of the terms
early on, and it stuck into some of the early docs and mindsets.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<
From: [EMAIL PROTECTED] (Randal L. Schwartz)
Date: 25 Apr 2001 07:23:44 -0700
In-Reply-To: <[EMAIL PROTECTED]>
Message-ID: <[EMAIL PROTECTED]>
Lines: 50
User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.3
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
>>>>
aning of the word "works". Ever try this:
@foo[0] = ;
and then wonder where all the *rest* of your input went?
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consult
] cmp $b->[1] } { uc } @list;
or to sort on GCOS and then username of password lines:
@sorted = sort { $a->[5] cmp $b->[5] or $a->[1] cmp $b->[1] }
{ split /:/ } `cat /etc/passwd`;
That captures the canonical ST pretty well, where $a->[0] is always
the original element.
d named "Ian", so I can see on a roster some day:
Schwartz,Ian
:-)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See
t not *by*
me (in fact, actually to spite me, if I recall).
Although it is fun when we get to the "Schwartizian Transform Illustrated"
page in my slideset... I get to say "don't wait for the swimsuit issue...
it's not a very pretty sight".
--
Randal L. Schwartz - Stone
arguments that omit their parentheses swallow up
Peter> the following list.
*some* functions. localtime doesn't. my is a unary function, prototyped
vaguely as (\$) or (\@) or (\%).
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]
ions.
No conspiracy could be that well-oiled. Someone would have leaked it
by now.
And consider the contrary for a moment... if this *is* a conspiracy
desgined to lock you out, what point would complaining about it do?
{grin}
To be a contribution to the community, you must have some higher
degree of
iling List: [EMAIL PROTECTED]
>> Number: 259
>> Version: 1
>> Status: Frozen
>> Frozen since: v3
Will> Neat versioning trick. =-)
He's freezing it "... in constant time".
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMA
integrate it into perl6.
CGI 3.01 is in the CPAN. I can't run it until 5.6.1 comes out though.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy
t will be FAR slower than the original tr///,
Bart> because it needs to search for the hash key for every single matching
Bart> character it finds. Plus, in Perl 5, NO core function returns a hash.
Bart> None at all.
It's not returning a hash. I like the proposal that has it re
the shift key around certain invocations
of Data::Dumper and then wonder why my program is core dumping.
Doh!
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical w
n we resolve this? That second paragraph doesn't take into account
what happens when I give 3 elements to a 7-element-at-a-time reduction
formula.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Per
};
:-)
Which of course won't work, unless there's a lot more magic going on.
(Which coderef gets the yield state attached to it, and would this properly
be recognized as a reason to clone the coderef?)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777
s" (like subroutines and map/grep
blocks) from either of those. But I'll need further time to process
your proposal to see the counterarguments now.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/
d there wouldn't be any clean
translation available. Ugh. Maybe we do need a new keyword. :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
way to distinguish those four cases:
"yes" and keep going
"no" and keep going
"yes" and abort after this one
"no" and abort after this one
What would you have "last" do? And how would you distinguish "the
ot
>>>>> "Peter" == Peter Scott <[EMAIL PROTECTED]> writes:
Peter> Make that uninit() for typing ease (only one char longer than undef) and I'd
Peter> vote for it. Makes a heck of a lot of sense.
uninit looks like a typo for "unit".
Maybe we
k about which single element to pull
out.
Since there's no general rule for converting a scalar to a list
(there's only twenty or so specific rules :), there's no consistent
way to take this coerced "list in a scalar context" and wrangle it
back to a scalar!
"list&
match a substring, and
Joe> then call an arbitrary function in the middle of a pattern match,
Joe> and to back out the call if the match failed.
Already done in 5.6. :) "perldoc perlre".
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECT
>>>>> "Larry" == Larry Wall <[EMAIL PROTECTED]> writes:
Larry> Randal L. Schwartz writes:
Larry> : if ($a == $b) { ... } # should this be string or number comparison?
Larry> Actually, it's a syntax error, because of the ... there. :-)
Larry
$a == "" $b)
so that it's DEFINITELY a string comparison.
No, let's not set Perl back 13 years, thank you very much.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/secur
above!
So, I'd support a modification to the RFC that does what Larry intended
here:
array interpolation should work exactly like scalar interpolation
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www
There is no existing "new" keyword in Perl. There's a convention that
the C++ people use when coming into Perl to call the simplest
constructor "new", but any name can be used for a constructor in Perl.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +
the variable name be something like
$ISA_SEARCH or something like that, to keep it in the same package.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writ
ere's no
*something* here. I don't know how much stuff this would break, but I
know I always backwhack my {'s regardless of where they are located in
the regex, not counting on the DWIM to do it right.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
erred form
Looks pretty direct to me. Maybe that was further than you could
read? :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
efs should
Chaim> simply be ignored.
If I understand you correctly, I want to disagree with you.
What if the "reduce" was to count the number of undefs?
$count = reduce { $a + not defined $b } 0, @some_list;
Do not discard undef from the source list.
--
Randal L. Schwartz - S
me" of which
he speaks is greater than the MTBF... Mean Time Between Firings.
:-)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
S
>>>>> "skud" == skud <[EMAIL PROTECTED]> writes:
skud> My $DEITY, someone sedate this man before he drowns us all in
skud> Perl RFCs! K.
>From the subject line, I thought it was another mailing list for me to
send in a subscription request!
--
Ra
>>>>> "Bart" == Bart Lateur <[EMAIL PROTECTED]> writes:
Bart> On 02 Aug 2000 16:42:35 -0700, Randal L. Schwartz wrote:
Steve> We could add a 'then' keyword.
>>
>> We have one. It's called "comma in a scalar context".
>>>>> "Steve" == Steve Fink <[EMAIL PROTECTED]> writes:
Steve> We could add a 'then' keyword.
We have one. It's called "comma in a scalar context". :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
but what the user types. If an author
Graham> does not document the two subs above correctly as returning a list and an array
Graham> then a user may get surprised.
Yes, but the first part is getting the naming right. You don't
"return an array". :)
--
Randal L. Schwart
have similar names. I
do it all the time. I think it makes sense. It also makes glob-ish
things similar, although I understand this is a separate issue up for
grabs.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://w
tter something about "lvalue subs" :) a sub
can return only an rvalue. An "array" as an rvalue is always a list.
Unless we disagree on the meaning of array and list. In that case,
let's get back to terminology. :)
--
Randal L. Schwartz - Stonehenge Consulting Services,
>>>>> "Chaim" == Chaim Frenkel <[EMAIL PROTECTED]> writes:
>>>>> "GB" == Graham Barr <[EMAIL PROTECTED]> writes:
GB> On Tue, Aug 01, 2000 at 07:41:59PM -0700, Randal L. Schwartz wrote:
>>> >>>>> &qu
k on either side, but then I might
as well go to a full while statement.
warn("too much information"), return 3 if $some_condition;
Very handy.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehen
>>>>> "Chaim" == Chaim Frenkel <[EMAIL PROTECTED]> writes:
Chaim> It's the overloading of the ',' operator.
Just like the overloading of the @ARRAY_NAME operator or the
getpwuid() operator. Perhaps you are back to merely complaining about
all
do something like
>>
>> use newbie;
>> or
>> use synonyms;
Do not tread this way until you have had to edit the V7 Bourne Shell
source code, codenamed "Algol in C". And then you would retreat,
rapidly.
--
Randal L. Schwartz - Stonehenge Consulting Services,
ag :-)
Not to be morbid, but you do have the code in escrow somewhere, just
in case, right?
:-)
(And do you fly... "in constant time"? :-)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Pe
rite that as:
$x = 0; $x += $_ for @list;
sure. :)
"A proud member of the Help Stamp Out Void Map/Grep Committee" :)
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Per
lk: " result _ (1 to: 10) inject: 0 into: [:a :b | a + b] "this is sum"
"perl: "; @result = reduce { $a + $b } 0, (1..10); # sum
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/&g
} 1..10;
Would it be 1..5, 1..6, 1..10, whatever it had before, or ()? I could
make arguments for each of them. :)
I think making that *not* a looping block makes more sense, so we
don't get into this nonsense. The "last" cleanly breaks out of the
innermost loopblock, which by defin
being detectable at runtime (see wantarray()) if
you want to do something special.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
return value. If you want a
new interface, *name* a new interface.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
82 matches
Mail list logo