On 10/12/2015 09:51 PM, Mark Overmeer wrote:
* Moritz Lenz (mor...@faui2k3.org) [151012 15:32]:
   . are they using :D correctly?

Yes, though not everybody uses :D as much as they do. Do you check that
all the parameters that your Perl 5 methods/subs receive are defined? If
not, you wouldn't use :D in Perl 6 either.

In Perl5, you get slower code when you test for definedness... in Perl6
you get faster (better optimized) code.  That's a big difference.

Do you? Did you actually measure that?

FWIW you can now (as of a few days ago) control the default with
use invocant :D;

How can de invocant not be defined?

Well, if you call a constructor, you call it on the type object. Hence the type object is the class, and not defined.

use parameters :D;

The new "use warnings"/"use strict"...

which means all those :D annotations can go away, and you have to use :_
explicitly if you want to allow all.

Oh, use :U for that.  Ehhh.... already in use.

:U means "undefined", :_ means "defined or undefined, I don't care"

And I don't know if we can change it now without creating a huge havoc
in the existing ecosystem.

There shouldn't be a problem making :D a superfluous option.  Of swiftly
add  "use parameters $_;"  to all modules.

Why shouldn't this be a problem?

 And there still quite a
number of other crucial changes going in anyway...

But hopefully none of them breaking backwards compatibility on such a large scale. The last few backwards incompatible changes still cause pain in the ecosystem. We have 390+ modules, and hand-waving away all trouble of maintaining them seems a bit lofty.

   . :D looks really ugly, don't you think?  Try to explain to students
     to add this smiley everywhere.

It's not uglier than a 'die "Must be defined" unless defined $x'

Much too expensive in Perl5.

Then don't do in Perl 6 either. If you can argue away the need for safety based on the need for performance, you can also argue away the need for safety based on the need for cleaner code.

Cheers,
Moritz

Reply via email to