HaloO,

Larry Wall wrote:
: or is 'bound of' proper english?

It doesn't really resonate for a native speaker.

--snip--

: > Plus, as we've defined
: >them above, subtypes are the most generic type you can name in Perl.

--snip--

I wasn't using the term "generic" in a type-theoretic sense.  Rather,
I was calling them generic in an operational sense, which you just
demonstrated.  You can turn any other type into a "subtype" alias that
adds no additional constraints.  Maybe I should have said the "widest"
type instead.

With the introduction of kind capture variables ^T we could complety
drop the subtype special form. As you pointed out the adding of constraints
happens with the where clause anyway. Thus we return to the usage of the
compile time name assignment form

  ::Blahh ::= ::Fasel where {...}

where the :: in all cases means working on the MIR (Meta Information
Repository) which is the world of names (In Russian, Mir (Мир) means
"peace," and connotes "community." --- cited from Wikipedia).

Question: shouldn't there be a natural 1 to 1 relation of ::T and ^T
or globally ::*T and ^*T where the former is the name and the latter
the kind represented by T? Of course scoping applies and there are
anonymous things that can be captured into ^T vars at runtime.

If the answer is 'yes' as I expect, I wonder if the compiler has to restrict
the usage of ::= to scopes which don't depend on runtime evaluations like

   if $x < 10 { ::*Surprise ::= ::*FunnyType; say 'did it'; }

Or should these be extracted out, making the above mean

   ::*Surprise ::= ::*FunnyType; # or further out if necessary

   if $x < 10 { say 'did it'; }


: Question: does a subtype declaration work only on package-like things
: which are addressed with a :: sigil? Or does your 'potentially
: contravariant' mean that arrow types can be constraint or aliased, as
: well?
: : subtype TakesInt of Sub where { .sig =:= :(Int --> Any) }; : : my TakesInt &foo; : : foo('a string'); # type error

Hmm, I would read that as declaring that &foo *returns* a TakesInt,
not that &foo *is* a TakesInt.  Just as

    my TakesInt @bar;

declares an array of individual TakesInt elements.

This is not too bad because then the & sigil is naturally associated
with the :( --> ) arrow type syntax and the forms can be mixed only
to the extent of signature aliasing:

    ::Takes3Ints ::= :(Int,Int,Int --> Any);

    my &foo:(Takes3Ints);

How does arrow typing apply to the three data sigils $, @ and %?
Compare:

    my $foo:(Int); # non-referential value type
    my $foo:(-->Int); # same? Or perhaps means anonymous ref/link/alias?
    my $foo:(Ref-->Int) # explicit reference? same as 'is ref' trait?
    my $foo:(Item: -->Int) # tied container

Which is the default when the Int is used in the type slot of the
declaration?

   my Int $foo;

Could this be used to define the key type of hashes?

   my %foo:(Blahh-->Any);

And shape of arrays

   my @foo:(Int,Int,Int-->Any);

where the Int or subtypes of it are enforced and Any defaulted.
Thus this could just be

   my @foo:(!,!,!);

The covariant invocant/container types are of course

   my $item :(Item:      --> Any);
   my @array:(Array: Int --> Any);
   my %hash :(Hash:  Key --> Any);

The & sigils have a free signature and ^ vars obviously have no signature
other than pure type ;)
--
$TSa.greeting := "HaloO"; # mind the echo!

Reply via email to