Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #67050] $str.Num should be the same as +$str

0 views
Skip to first unread message

Moritz Lenz

unread,
Jun 29, 2009, 8:10:01 AM6/29/09
to bugs-bi...@netlabs.develooper.com
# New Ticket Created by Moritz Lenz
# Please include the string: [perl #67050]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=67050 >


13:52 < zulon> rakudo: say "3".Num
13:52 < p6eval> rakudo d95def: OUTPUT«Method 'Num' not found for
invocant of class 'Str'␤»
13:52 <@moritz_> zulon: that should work


Brandon S. Allbery KF8NH

unread,
Jun 30, 2009, 4:55:12 AM6/30/09
to perl6-c...@perl.org, Brandon S. Allbery KF8NH, bugs-bi...@netlabs.develooper.com
I thought unary + was scalar/item? context in perl6, not numify.

--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] all...@kf8nh.com
system administrator [openafs,heimdal,too many hats] all...@ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH


PGP.sig

Mark J. Reed

unread,
Jun 30, 2009, 6:10:10 AM6/30/09
to Brandon S. Allbery KF8NH, perl6-c...@perl.org, bugs-bi...@netlabs.develooper.com
On Tue, Jun 30, 2009 at 4:55 AM, Brandon S. Allbery
KF8NH<all...@ece.cmu.edu> wrote:
> I thought unary + was scalar/item? context in perl6, not numify.

 + is numeric context - which is one of several subtypes of item
context. Generic item context is item(); + numifies; ? boolifies; ~
stringifies.

I'm guessing you saw + used to get the length of an array, and that's
where you got that it's equivalent to P5 scalar().

--
Mark J. Reed <mark...@gmail.com>

perl6-bug...@perl.org

unread,
Jun 30, 2009, 5:25:35 AM6/30/09
to perl6-c...@perl.org
On Tue Jun 30 01:56:39 2009, all...@ece.cmu.edu wrote:
> I thought unary + was scalar/item? context in perl6, not numify.

When in doubt, check the spec. :)

S03 (]):
] Unlike in Perl 5, where + is a no-op, this operator coerces to
] numeric context in Perl 6.

So prefix:<~> stringifies, prefix:<+> numifies, and prefix<?> boolifies.
There's some kind of nice symmetry to that, isn't there?

0 new messages