这显然是不可能的...
role Versioned {
method version () {
return self.^api;
}
}
class WithApi:ver<0.0.1>:auth<github:JJ>:api<0> does Versioned {}
class WithApi:ver<0.0.1>:auth<github:JJ>:api<1> does Versioned {}
say WithApi:api<0>.new.version;
say WithApi:api<1>.new.version;
这与
==SORRY!=== Error while compiling /home/jmerelo/progs/perl6/my-perl6-examples/api-versioned.p6
Redeclaration of symbol 'WithApi'
at /home/jmerelo/progs/perl6/my-perl6-examples/api-versioned.p6:11
------> 1>:auth<github:JJ>:api<1> does Versioned⏏ {}
那么甚至可以在一个程序中use
使用不同的s,相同的名称吗?api
更新:如果它们包含在不同的文件中,这是获得的错误:
P6M Merging GLOBAL symbols failed: duplicate definition of symbol WrongType