-
-
12 Aug 2002 13:20:58 UTC
- Distribution: types
- Module version: 0.05
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (3)
- Testers (0 / 5 / 313)
- Kwalitee
Bus factor: 1- 87.50% Coverage
- License: unknown
- Perl: v5.800.0
- Activity
24 month- Tools
- Download (7.04KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- B::Generate
- optimize
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
types - Perl pragma for strict type checking
SYNOPSIS
use types; my int $int; my float $float; $int = $float; # BOOM compile time error!
ABSTRACT
This pragma uses the optimzie module to analyze the optree and turn on compile time type checking
SYNOPSIS
my float $foo = "string"; #compile time error sub foo (int $foo) { my ($foo) = @_ }; foo("hi"); #compile time error my int $int; sub foo { my float $foo; return $foo } $int = $foo; # compile time error
DESCRIPTION
This pragma uses the optimzie module to analyze the optree and turn on compile time type checking
Currently we support int, float, number ,string and user defined classes, the implict casting rules are as follows.
int < > number int > float float < > number number > string
Normall type casting is allowed both up and down the inheritance tree, so in theory user defined classes should work already, requires one to do use base or set @ISA at compileitme in a BEGIN block.
Return values
Return values are implicitly figerd out by the subroutine, this includes both falling of the end or by expliticly calling return, if two return values of the same sub differ you will get an error message.
Arguments
Arguments are declared with prototype syntax, they can either be named or just typed, if typed only the calling convertions are checked, if named then that named lexical will get that type without the need for expliticty typing it, thus allowing list assignment from @_
EXPORT
None.
BUGS
Please report bugs and submit patches using http://rt.cpan.org/
SEE ALSO
optimize B::Generate optimizer
AUTHOR
Arthur Bergman, <ABERGMAN@CPAN.ORG>
COPYRIGHT AND LICENSE
Copyright 2002 by Arthur Bergman
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install types, copy and paste the appropriate command in to your terminal.
cpanm types
perl -MCPAN -e shell install types
For more information on module installation, please visit the detailed CPAN module installation guide.