Hacker News new | ask | show | jobs
by username223 3859 days 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.

2 comments

"my" is shorter than "local" or "let" and fairly evocative. Maybe you should ask why other languages don't use "my", instead. :P
"my" arrived after "local". The former is true lexical scoping, the latter isn't quite.
Right. 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.

Think locally, act globally.