> =head1 TITLE
>
> Controllable Data Typing
>
> =head1 VERSION
>
> Maintainer: Syloke Soong <[EMAIL PROTECTED]>
> Mailing List: [EMAIL PROTECTED]
>
<...>
>
> Retain current flexibility of Perl liberal variables.
> Provide a new form of declaring variables:
>
> scope cast-type $varname:constraint;
>
<...>
>
> =head2 Constant constraint
>
> A constant confered by the keyword const creates a final value; That value
stays
> immutably the same throughout the scope of its existence.
>
I don't think this RFC is the place to try and cover all of the
'constraints' that might be in perl 6. Sure, this RFC may as well be the one
to formalise the notation that attributes of variables are defined in this
way, but also trying to enumerate and describe them would make this RFC very
bloated.
On the 'const' issue specifically, there's already an RFC for that (RFC 83).
Syloke--if you really want to incorporate this RFC then please let me know,
and I'll send you all of the suggested changes I've received in feedback to
RFC 83. However, I think it would be much easier if we kept discussion of
the actual 'constraints' in separate RFCs, allowing debate on each issue to
be kept separate.
Furthermore, using the term 'constraint' is misleading--I think 'attribute'
is better. Another to-be-proposed attribute is 'sparse', which gives Perl
information about how to store a list. And then of course there's character
set type attributes (eg 'utf8')... These are not constraints, but they all
use the same notation.
Finally, the attribute notation needs a way of taking parameters. For
instance, the 'sparse' attribute needs a default value, and an optional
'sparsity index'. We need syntax that allows something like:
my int @sparse_array : sparse(0,0.99) = ((0) x 50000 , 1);