3 ms·
> I however don't understand the reason for naming of eg elsif, my, slurp/spurt?? Yes, it's for historical reasons. "elsif" is spelled that way in Perl 5. Pe
by username223 11y ago
> I however don't understand the reason for naming of eg elsif, my, slurp/spurt??
Yes, it's for historical reasons. "elsif" is spelled that way in Perl 5. Perl 5 has both "my" and "local" to specify lexical and dynamic scoping, respectively, so Perl 6 using "local" for lexical scope would be confusing. "slurp" is a common term for reading the entire contents of a file at once.
- cafard 11y ago"my" arrived after "local". The former is true lexical scoping, the latter isn't quite.
- tbrownaw 11y agoRight. As gp says, "local" is dynamic scoping. It's available as long as the declaration stays on the call stack. It more-or-less allows globals to be temporarily redefined.
- DonHopkins 11y agoThink locally, act globally.
- omaranto 11y ago"my" is shorter than "local" or "let" and fairly evocative. Maybe you should ask why other languages don't use "my", instead. :P