This and other RFCs are available on the web at
  http://dev.perl.org/rfc/

=head1 TITLE

Controllable Data Typing

=head1 VERSION

  Maintainer: Syloke Soong <[EMAIL PROTECTED]>
  Mailing List: [EMAIL PROTECTED]
  Date: 10 Aug 2000
  Version: 1
  Number: 89

=head1 ABSTRACT

Provide a choice for a programmer to define non-convertible and
semi-convertible variables with explicit data-types.

=head1 DESCRIPTION

Current intelligence and flexibility of Perl variables are extremely
indispensable.  However at times this feature is also extremely
inconvenient. As an example, character string "007" is often mistaken as
int 7. So that concatenation of a variable strings "001999", "." , "03"
to form an output filename could, unless with more extensive treatment,
form a filename of 1999.3 instead.  Attempts at storing into a hash with the
key "007" or "  7" rather than 7 is a trying experience. Not to mention
attempts at reading a hash using similar keys.

=head1 IMPLEMENTATION

Retain current flexibility of Perl variables.
Provide a new form of declaring variables:
  
        my $varname type;
or

        my $varname (type);

Allow the following forms to fix the data-type of a variable:

        my $k int;
        my $str varchar;
        my $str (varchar);
        my @astr (varchar);
        my $ff (int,double);

        my @allowedtypes = (int,varchar);
        my $ivd @allowedtypes;
        if ($somecondition){push @allowedtypes , double}

>From then on, evaluations on $k shall always return an integer,
unless a stringified or type-float evaluation is explicitly done on it.
$str would behave as a variable length string. $ff would behave as a
Perl5 flexible variable but constrained to either int or double.
Initially $ivd would be allowed the behave either as int or varchar.
On condition $somecondition, it is allowed an additional degree of freedom
of double due to appendage to the array @allowedtypes.

=head1 REFERENCES



Reply via email to