develooper Front page | perl.perl6.language | Postings from August 2001

Re: Will subroutine signatures apply to methods in Perl6

Thread Previous | Thread Next
Uri Guttman
August 24, 2001 16:09
Re: Will subroutine signatures apply to methods in Perl6
Message ID:
>>>>> "DC" == Damian Conway <> writes:

  DC> One might also envisage a C<use strict 'typing'> pragma to require
  DC> that all lexicals be typed.

do you mean lexical params in a sub signature? or all lexicals in the
current scope which contains the pragma?

required typing for all lexicals feels too strong. many lexicals are
just ordinary scalars and don't type well unless we require an
int/string/float/ref type.

what about making that mean that any scalar being assigned a method call
(compile time checked only), must have a type? it would not be too broad
and should be simple to check and it has useful behavior. 

	use strict 'typing' ;

	my $foo = ;

that fails at compile time.

	my Dog $spot = ;

that is ok.

	my Canine $spot = ;

that is ok if Dog ISA Canine. $spot could be assigned a Dog or a Cat

	my $foo = foo() ;

is fine too, since no compile time detection of OO values is made.


Uri Guttman  ---------  ----------
SYStems ARCHitecture and Stem Development ------
Search or Offer Perl Jobs  --------------------------

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About