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

Re: Will subroutine signatures apply to methods in Perl6

Thread Previous | Thread Next
From:
Uri Guttman
Date:
August 24, 2001 16:09
Subject:
Re: Will subroutine signatures apply to methods in Perl6
Message ID:
200108242308.TAA07920@home.sysarch.com.
>>>>> "DC" == Damian Conway <damian@mail.csse.monash.edu.au> 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 = Dog.new() ;

that fails at compile time.

	my Dog $spot = Dog.new() ;

that is ok.

	my Canine $spot = Dog.new() ;

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

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs  --------------------------  http://jobs.perl.org

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About