Says Dave Mitchell:
> Closures ... can also be dangerous and counter-intuitive, espcially to
> the uninitiated. For example, how many people could say what the
> following should output, with and without $x commented out, and why:
>
> {
> my $x = "bar";
> sub foo {
> # $x # <-
On (03 May 2001 10:23:15 +0300) you wrote:
> Michael Schwern:
> >
> > Would be neat if: my($first) = grep {...} @list; knew to stop itself, yes.
> >
> > It also reminds me of mjd's mention of: my($first) = sort {...} @list;
> > being O(n) if Perl were really Lazy.
>
> But it would need a
> So you can say
>
> use Memoize;
> # ...
> memoize 'f';
> @sorted = sort { my_compare(f($a),f($b)) } @unsorted
>
> to get a lot of the effect of the S word.
Yes, and of course the inline version of this technique is also
common:
@sorted = sort { my $ac = $cache{$a} ||= f($a);
Bart Lateur:
> >If there are no objections, I will freeze this in twenty-four hours.
>
> Oh, I have a small one: I feel that this pseudo-random salt should NOT
> affect the standard random generator. I'll clarify: by default, if you
> feed the pseudo-random generator with a certain number, you'l
ot
share pads, the code will continue to work.
So your proposal can be saved, but it needs to be fixed.
Mark-Jason Dominus [EMAIL PROTECTED]
I am boycotting Amazon. See http://www.plover.com/~mjd/amazon.html for details.
ever.
The programmer can also examine the occurrences of 'perl5_eval' in the
source code to decide whether they can be converted immediately to
plain 'eval'.
Once all the appearances of perl5_eval have been replaced, the
translator is no longer needed.
Mark-Jason Dominus
> eval should stay eval.
Yes, and this is the way to do that.
When you translate a script, the translator should translate things so
that they have the same meanings as they did before. If it doesn't
also translate eval, then your Perl 5 scripts will be using the Perl 6
eval, which isn't wha
> > One could for example have a pragma to *really* tag variables
> > lexically to be expanded within singlequotes.
Or a pragma that simply changes the semantics of q{...} so that it has
the proposed feature for the rest of the scope of the current block.
The perl 5 -> perl 6 translator should replace calls to 'eval' with
calls to 'perl5_eval', which will recursively call the 5->6 translator
to translate the eval'ed string into perl 6, and will then eval the
result.
Mark-Jason Dominus
> seconded by Mark-Jason Dominus <[EMAIL PROTECTED]>
Except that I don't think adding this feature to the existing q{...}
is a good idea. If I had to vote on your proposal, I would instantaly
vote against it. I think you should have invented a new operator or a
pragma or something.
> =head1 TITLE
>
> crypt() default salt
>
> =head1 VERSION
>
> Maintainer: Mark Dominus <[EMAIL PROTECTED]>
> Date: 11 Sep 2000
> Last Modified: 13 Sep 2000
> Mailing List: [EMAIL PROTECTED]
> Number: 208
> Version: 2
> Status: Developing
If there are no objections, I will freez
> This reminds me of a related but rather opposite desire I have had
> more than once: a quotish context that would be otherwise like q() but
> with some minimal extra typing I could mark a scalar or an array to be
> expanded as in qq().
I have wanted that also, although I don't remember why ju
> You talked about Good Typing at YAPC, but I missed it. There's a
> discussion of typing on perl6-language. Do you have notes or a
> redux of your talk available to inform this debate?
http://www.plover.com/~mjd/perl/yak/typing/TABLE_OF_CONTENTS.html
http://www.plover.com/~mjd/perl/yak/typing
g
This warns you that C<"[EMAIL PROTECTED]"> is going to turn into
C if you don't backslash the C<@>.
See L<http://www.plover.com/~mjd/perl/at-error.html> for more details
about the history here.
Mark-Jason Dominus
application. Perl has two equality comparison operators and people
aready complain that that is too many.
Mark-Jason Dominus [EMAIL PROTECTED]
I am boycotting Amazon. See http://www.plover.com/~mjd/amazon.html for details.
Each process has one real UID, and only one, so a
global variable for $< is perfectly OK.
$_ is in a class by itself.
Summary of manifesto: Global variables must be expunged.
Replacing the old rotten global variables with new rotten global
variables is not enough of an improvement.
Mark-Jas
16 matches
Mail list logo