I don't know why the “parametrizable” never registered regardless of my repeated mention.

  1. How are you going to define a type for reals in the range 0.0 to 1.0?
  2. And another for those in the range -1.0 to +1.0?
  3. And another for integers that can be (-1|0|+1)?
  4. And another for dates this year? This month? This century?
  5. And another for daytimes? Nighttimes? Weekends? First days of the month?
  6. And one for 3-char strings? and 4-chars strings? and 5-char strings? And lowercase 3-char strings? and uppercase 3-char strings? And lowercase, 3-char strings that begin with 'a'? And lowercase 3-char strings that begin with 'b'? …or 'c'? …or 'd'?
  1. my $foo is Real( 0.0, 1.0 );
  2. my $foo is Real( -1.0, 1.0 );
  3. my $foo is InSet( -1, 0, -1 );
  4. my $foo is DateTime( year => DateTime.now.truncate( to => 'year' ) ); # ...
  5. my $foo is DateTime( hour => [ 8 .. 22 ] ); # ...
  6. my $foo is String( len => 3 ); # ...
    my $foo is String( match => /\A a [[:lower:]]{2} \z/ ); # ...

For the Real constructor I could even imagine some syntax like qw( ] 0.0 - 1.0 ] ) (I don't remember which dingbats we'll use in Perl6 for qw//) which would define a range from 0.0 exclusive to 1.0 inclusive — just like the mathematical notation.

Use your imagination. Did I mention declarative programming is bliss for maintainers?

Makeshifts last the longest.


In reply to Re^22: Assignable Subroutines by Aristotle
in thread Assignable Subroutines by dragonchild

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.