develooper Front page | perl.perl6.language | Postings from May 2005

Type system questions.

Thread Next
Autrijus Tang
May 3, 2005 02:06
Type system questions.
Message ID:
With the recent discussion on type sigils, and the fact that Pugs
is moving toward the OO core, I'd like to inquire how the following
statements evaluate (or not):

    # Compile time type arithmetic?
    ::Dual ::= ::Str | ::Num;
    $*Dual ::= ::Str | ::Num;

    # Run time type arithmetic?
    my ::dual := ::Str | ::Num;

    # Type Instantiation?
    sub apply (&fun<::a> returns ::b, ::a $arg) returns ::b {

    # Does Role live in the same namespace as Types/Classes/Modules/Packages?
    my ::role = role { ... };

    # Can class take type parameters like Roles cna?
    class Pet[Type $petfood] {
	method feed (::($petfood) $food) {...}

    # Single colon as tuple composer?
    my $Triple		::= :(Bool, Int, Str);
    my $TripleTuple	::= :($Triple, $Triple);
    my &pair_with_int	::= -> Type ::t { :(::t, Int) };


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