Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • I haven't been following the language development too closely, but "^5" as sugar for "0..4" seems a little too ad-hoc for me. For consistency, I would expect that if ^class gets me the metaclass, then ^instance should get the class. So ^5 == Int or something like that.
    • For the ranges, it'll probably seem less strange if I add that $x...^$y means "the range from $x up to but excluding $y" - without the ^ it'd be up to and including $y. You can stick a ^ on either side of the .., or both, though that's not yet implemented. So ^$y is just shorthand for 0..^$y.

      So it's actually the ^TypeName case that is the more weird one. The spec (S03) mentions that both get the "domain" of the thing to the right of them in an abstract-y kinda way. Also, ^ is used to mean "meta-class" in other a number of other cases.

      It's a tad odd, but I think you'd have to be doing something pretty contrived to get into a situation where it was unclear which you're doing from just looking at the code. And while ranges are something you play with often, I doubt most everyday programmers will be caring about the metaclass so often, if at all.

      Hope this helps you understand it, even if not like it. :-)

      Jonathan