On Tue, Aug 01, 2000 at 05:31:56PM -0600, Tom Christiansen wrote:
> >Several people have suggested strong typing as a feature, and have been shot
> >down one by one.  However, I think it can be done without forcing it on
> >everyone.
> 
> Can it?  Are you prepared to make everyone declare the full, formal, and
> fancy types for the return values of all their functions?  

No, this was intended to be a suggestion to provide a pragma or hooks (all
of which are nearly doable in Perl 5) for type checking.  This moves the
onus of setting up a proper type-checking environment onto the shoulders of
developers who wish to have type checking.

I raised the question about how to handle it when a subroutine doing type
checking is called by code that isn't; the question can go the other way. 

For the first situation (a subroutine doing type-checking is called by code
that is not) there will probably have to be a runtime penalty to coerce the
parameters into type-checked values.

For the second situation (code doing type checking calls a subroutine that
is not) would be much like the previous situation (runtime penalty, coercion
of return values into type-checked values).  There is also a management
problem: suddenly some of your values aren't being type-checked.  The only
solutions I can think of offhand are: take your lumps and accept that some
things won't be checked; write wrapper functions that -do- check; have some
sort of mechanism that's basically a language- or pragma-level construct
that does the wrapping for you:

    typing_proto funcname => [qw(ARRAY INTEGER HASHREF)], [qw(FLOAT)];


I'm not sure how well this fits into my original musings on doing certain
things at compile-time to provide for compile-time warnings.  It probably
doesn't.

 
Michael
--
Administrator                      www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

Reply via email to