# New Ticket Created by  Lloyd Fournier 
# Please include the string:  [perl #125762]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=125762 >


Context: I am trying to make a fun syntax where Class[@args] is an alias
for Class.new(@args)

-----
class C {};
sub postcircumfix:<[ ]>(C:U $c, Str $arg){ say 'win' };
my $c = C;
$c['test']; #-> win
C['test'];  #!> C cannot be parameterized

------
I also tried:
------
role R { method parameterize(|) { say $*d; } };
class C {};
BEGIN { C.HOW does R };
my $*d = 'win';
C[my $a = 'test']; #-> win
C['test']                #!> Dynamic variable $*d not found

------
But I can't use dynamic variables because if it's called with a compile
time variable it runs .parameterize at compile time only.

I tentatively suggest that at least one of these is a bug as they together
prevent you using [] on a type to callback to something using $*dynamic
variables consistently.

Reply via email to