develooper Front page | perl.perl5.porters | Postings from May 2000

Re: overloading = [a solution]

Thread Previous | Thread Next
From:
Damian Conway
Date:
May 5, 2000 22:34
Subject:
Re: overloading = [a solution]
Message ID:
200005060534.PAA07092@indy05.csse.monash.edu.au
   > Cool. B&D finally comes to perl (in an option, only if you like that
   > sort of thing way :))
   > The name sucks, though.  Unfortunately I have no ideas for a better one.
   > Perhaps Type::something or Typed::something.
   > Hmm, think I like Typed::vars or Typed::Vars.

At the moment I'm planning to rename it Class::TypedVars, so as not to create
a new top-level namespace. 

Though I confess that:

	use B'n'D;

has a certain appeal (and is even in an existing CPAN namespace ;-)


   > 'classify' would then need to be renamed to 'type'.
   > Could type be polymorphic enough to perform both functions?

It *could* (i.e. it could check whether its first argument is an lvalue),
but I think it's better to preserve a syntactic distinction to mirror the
semantic distinction.

Upon further reflection, C<classify> might be better named C<restrict>:

	restrict my $obj => 'MyClass';

Damian

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