in reply to Re: Sigils in Perl 6
in thread What's wrong with Perl 6?

Well, those are all true to some extent in Perl 5 as well. In addition to those reasons, Perl 6 pushes sigils in a direction that makes more sense in the context of human linguistics: I'm sure I could think of more reasons if I tried, but those are good enough. :-)

Replies are listed 'Best First'.
Re^3: Sigils in Perl 6
by ysth (Canon) on May 15, 2007 at 16:53 UTC
    For those as clueless as me: twigil
      And just to add something that is not explained at all in the synopsis, the idea of twigils is actually stolen straight from Ruby, which uses sigils to indicate strange scoping rather than data structure. A lovely idea, but using up sigils for that limits the extensibility of the mechanism, because there aren't that many ASCII symbols left to use in the sigil position that don't already mean something else. But by placing the scope indicator in the twigil position (that is, after a mandatory sigil), we can reserve the rest of the symbol keys on your keyboard to indicate future scopes that maybe haven't even been invented yet. Maybe someone will invent transaction scopes, for instance.

      So I think of twigils as just another way of making Perl more like Perl. As with sigils, the primary purpose of twigils is to give you, the reader, a visual clue about what's going on in a bit of code without having to memorize every declaration surrounding this scope. The moment you see something like $?FOO you can know that it's a variable to the compiler but a constant to the compiled code, without having to memorize a list of special symbols, or use weird non-sigil conventions like __FOO__.

        So is ^ a perl5 twigil?
        But by placing the scope indicator in the twigil position (that is, after a mandatory sigil), we can reserve the rest of the symbol keys on your keyboard to indicate future scopes that maybe haven't even been invented yet.
        Would that mean new twigils can be introduced by application programmers? So, e.g. Catalyst::Controller::BindLex could use this instead of attributes?

        /J