HaloO,
Luke Palmer wrote:
On 10/20/05, Larry Wall <[EMAIL PROTECTED]> wrote:
Another thing I didn't mention is that that binds both the variable
and its class. But the $ variable is of course optional after the
type, so you could just write that
sub sametype (¢T, ¢T) {...}
if you don't actually care about $x and $y. Basically, ¢T captures
the type of the associated scalar in any lvalue or declarative context,
whether or not hte scalar itself is captured.
Does this capturing of the type into ¢T also involve runtime
code template expansion? That is, if sametype(Int,Int) didn't
exist it would be compiled on the fly for a call sametype(3,2)?
Which brings up the question if ¢T will be allowed in multi defs?
And how does it influence dispatch then? Can type variables be
constrained with where clauses?
So it's a type position thing if it can be. Good. (I wonder if,
since it's allowed in term position, we will come up with ambiguities)
How about this:
sub foo(c|T $x) {
my sub util (c|T $in) {...}
util($x)
}
Is that c|T in util() a new, free type variable, or am I asserting
that the type of util()'s argument must be the same type as $x?
I would guess there are two distinct ¢foo::T and ¢foo::util::T free
type variables. In the call of util($x) the type reference is handed
or rebound down the call chain just like value refs. BTW, will there
be a topic type ¢_, grammar type ¢/ and the exception type ¢! as well?
What operations are available for type variables? E.g. ¢foo <= ¢bar could
be the subtype relation. But what would ¢foo + ¢bar mean? Is ¢foo - ¢bar
the dispatch distance? Is the compiler obliged to separate type variables
from value variables? Or does
$foo = \¢bar;
produce a type reference? How would that be dereferenced then? Is the type
inferencer in the compiler automatically calculating a supertype bound
for every expression? If yes, how is that accessable?
--
$TSa.greeting := "HaloO"; # mind the echo!