You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I recently found Zydeco and I've been toying with it recently.
I'm wondering if there's a way to declare a type alias, that has the same type as its underlying representation.
Basically, something like type Level = NumRange[1, 80];.
While investigating the libs behind Zydeco, I found out that use Type::Utils -all would give me a declare function (though it seems to be a keyword at other points, because I see declare MyType unquoted?), but I couldn't manage to get it to work doing it either from my main package or from my MAINPKG::Types (that I created originally to work around #15), they both error either when declaring it or when using it (sometimes in an unrelated file that also uses Zydeco...).
Thanks!
The text was updated successfully, but these errors were encountered:
use v5.30;
BEGIN {
packageMyTest::Types;
use Type::Library -base, -utils;
use Types::Common qw( NumRange );
declare Level=>as NumRange[ 0, 80 ];
}
packageMyTest {
use Zydeco;
class Bucket {
has fill ( type=> MyTest::Types::Level() );
}
}
say MyTest->new_bucket( fill=> 100 );
I agree that a nicer way to declare aliases would be good.
Ah, thanks. I was wondering if Exporter::Almighty had such a hatch, but this'll do for now. I also omit the () because otherwise,the type won't parse in method parameter type specifiers.
Hi! I recently found Zydeco and I've been toying with it recently.
I'm wondering if there's a way to declare a type alias, that has the same type as its underlying representation.
Basically, something like
type Level = NumRange[1, 80];
.While investigating the libs behind Zydeco, I found out that
use Type::Utils -all
would give me adeclare
function (though it seems to be a keyword at other points, because I seedeclare MyType
unquoted?), but I couldn't manage to get it to work doing it either from my main package or from myMAINPKG::Types
(that I created originally to work around #15), they both error either when declaring it or when using it (sometimes in an unrelated file that also uses Zydeco...).Thanks!
The text was updated successfully, but these errors were encountered: