http://www.perlmonks.org?node_id=439327


in reply to Re^3: Smart match in p5
in thread Smart match in p5

I doubt it breaks any script or module at all. Double ~ is already extremely rare currently, and using ~~ such that it's parsed differently with my patch applied seems only possible in contrieved situations.

This is the only scenario I've come up with so far:

print $fh ~~EXPR;

Replies are listed 'Best First'.
Re^5: Smart match in p5
by demerphq (Chancellor) on Mar 14, 2005 at 16:24 UTC

    Double ~ is already extremely rare currently, and using ~~ such that it's parsed differently with my patch applied seems only possible in contrieved situations.

    Based on what analysis? Is this just your opinion based on your experience or is it actually backed up a sampling of Perl modules from CPAN?

    My point here is that i think this all is an interesting and clever idea that should go through the acceptance process, but that IMO you will need better evidence than that which you and Juerd have provided so far. Anyway.... I actually agree that this will probably prove to be a very rare construct, but you should have some solid numbers to back it up. Anyway, i hope you try to get this into blead, i think it would be nice.

    ---
    demerphq

      or is it actually backed up a sampling of Perl modules from CPAN?

      CPAN is not a good source of information, as ~~ (as short form of "scalar") is used mostly in one liners. That use is still valid, except with the weird print syntax. But ~~ was never meant like this anyway. ~ Just happens to be a reversible operation that works losslessly on both strings and numbers.

      Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

        Thing is its not good enough to say "CPAN is not a good source of information" nor is it good enough to say "probably wont break anything".

        If CPAN isnt good enough then what is better? If there isnt anything better then CPAN is all you have. If you can turn around to P5P and say gee whiz, in 5000 CPAN modules ~~ isnt used once then you have an argument, if you say to them "CPAN isnt a good source of information as ~~ is only used in one liners and this patch probably wont break anything" then I would have to assume they will not take your efforts seriously. Nor should they and nor should you expect them to...

        ---
        demerphq

      CPAN is irrelevant when it comes to getting an estimate. Sure, if it breaks a gazillion CPAN modules, it'll break a lot. But the fast majority of Perl code out there isn't on CPAN, and isn't written by people keeping in touch with Perl development, or the Perl community.

      The fast majority of Perl code is written by anonymous coders. Good coders, bad coders, coders who know a lot of Perl, coders who use a subset, coders who code by example. It's even unknown on which systems perl runs on - so anything estimate on how many programs it will break is just guesswork.

        Sorry, but your argument amounts to "we will never know how likely it is to get cancer from smoking because the vast amount of people aren't in our study, and there are more in people not in our study than are in it thus the data on how many people got cancer is totally useless".

        Good thing you arent a doctor eh?

        The fact is that if you check cpan and find out that 100% of the the modules on it use ~~ then its a pretty darn good suggestion this will break a lot of things. If you check it and find out that it doesnt occur even once then its pretty darn good suggestion it wont be found much in the wild. Personally were I pumpking I would feel a lot more at ease integrating a patch in the later case, but certainly wouldnt in the former.

        Can we stop it with the "1 GB sample of code cant be used to establish usage frequencies" argument? Its a bit tired, and wasnt a good one in the first place anyway.

        ---
        demerphq