http://qs321.pair.com?node_id=11126698


in reply to Re: Is typeglob feature really useful? (typeglob references)
in thread Is typeglob feature really useful?

Thanks for your reply and sharing. I realize that what I post is not saying typeglob is bad feature, but the current implementation for it decrese performance. maybe that's why raku abandon this feature?




I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Replies are listed 'Best First'.
Re^3: Is typeglob feature really useful?
by eyepopslikeamosquito (Archbishop) on Jan 10, 2021 at 10:50 UTC

    I don't know why typeglobs were removed from raku and my google-fu wasn't good enough to find a clear explanation of Larry's rationale for this. However, I did find How naming of variables works in Perl 6 by Elizabeth Mattijsen which states:

    As you may have noticed, Perl 6 does not have a * sigil nor the concept of typeglobs. If you don't know what typeglobs are, you don't have to worry about this. In Perl 6, the sigil is part of the name stored in a symbol table, whereas in Perl 5 the name is stored without the sigil. For example, in Perl 5, if you reference $foo in your program, the compiler will look up foo (without sigil), then fetch the associated information (which is an array), and look up what it needs at the index for the $ sigil. In Perl 6, if you reference $foo, the compiler will look up $foo and directly use the information associated with that key. Please do not confuse the * used to indicate slurpiness of parameters in Perl 6 with the typeglob sigil in Perl 5 -- they have nothing to do with each other.

    To make any sort of case for their removal from Perl 5, you'll need to do more than assert that "the current implementation for it decrease performance". You'll need to prove it by publishing some benchmarks. Given the backward compatibility nightmare that would be unleashed if typeglobs were removed from Perl 5, it seems preferable to me to leave them in the language and instead try to improve their performance. Admittedly, that's not for me to say, I don't have the skills or desire to be a Perl 5 pumpkin. If you feel strongly enough about it, I suggest you publish some benchmarks and discuss on P5P.