I was thinking about the case where you use a module, only to define a class that you then instantiate like this:
use Some::Module::That::Defines::A::Class; our Some::Module::That::Defines::A::Class $foo := new;
and I keep thinking that that's too redundant. It's not so much that I want to syntax-golf it down, but there's just no reason to throw that type around twice, when what you really WANT to say is "that module over there is a class, instantiate me one."
So, I was wondering about a synonym, like:
uses Some::Module::That::Defines::A::Class $foo;
syntax will be awful and there are a lot of guesses, but:
macro uses($class, $var) is parsed(/(<classname>) (<scalar>)/) { use $class; our $class $var; }
I suspect. It's probably not quite that simple, but I figured it was worth a shot. Hopefully the compiler would run through the result of the macro, parse it and compile it as normal so the C<use> would actually work.
Okay okay, I just got a copy of Perl 6 and Parrot Essentials and I'm trying to learn stuff. I'm even ripping apart the compiler I wrote for my BSc final-year project so it generates working PIR instead of broken C.