* 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.

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

How can de invocant not be 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.

> That said, I agree that it's the wrong default. And the design documents
> even mandate a default to :D, though at the time it was written, it
> wasn't clear how to switch off that default, nor how to avoid having to
> write
> 
>       method new(MyClassHere:U: *@args) { ... }
> 
> in the constructor, which would be quite hostile to newbies. It's still
> not clear to me how to avoid that.

It is also unclear to me what this means.  It is a method which requires
and undef parameter?

> 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.  And there still quite a
number of other crucial changes going in anyway...

> Another concern is that if "everything" defaults to :D, then classes
> (and other type objects) aren't really first class objects anymore,
> which is a really neat thing to have.

Can you give me an example?  Many other languages are capable to live
without undef and have first class type objects.  In the old days, I
had to implement the Algol68 style during compile construction course ;-)

> >   . :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.
-- 
Regards,

               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       m...@overmeer.net                          soluti...@overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net

Reply via email to