To :D or not to :D

[email protected] (Mark Overmeer)
Newsgroups perl.perl6.language
Organization MARKOV Solutions
Message-ID <[email protected]>
Hi all,

Liz and Tux demonstrate powerful Perl6 code at each monthly meeting of
our Mongers in Amsterdam.  Looking at their examples, I collected a few
questions of which I want to discuss the first one in this thread.


When I look at Merijns (Tux') code, I see a huge number of :D attributes.
    https://github.com/Tux/CSV/blob/master/lib/Text/CSV.pm

Close to all scalar positional parameter (51x) carry the :D flag.  I count
only 3 where the parameter does accept undef and the method is able to
handle it.  I count another 3 where the :D is missing, but the method is
not able the handle it.

The same for examples Liz shows us in our core code: most scalar
positional parameters have :D.

Writing a sub which is able to handle undef is usually more work than
implementing "I expect sane values for all of the parameters".


Questions:
  . are they using :D correctly?
  . the simpelest code does not handle the undef case... but now needs
    the more complex prototype to be correct.
  . it feels like the wrong default: usually you have to do something
    extra for the unusual cases, not the 90%+ usual cases.
  . :D looks really ugly, don't you think?  Try to explain to students
    to add this smiley everywhere.

Can someone explain this to me?  (Or point me to the correct place)
-- 
Thanks in advance

               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       [email protected]                          [email protected]
http://Mark.Overmeer.net                   http://solutions.overmeer.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.