On Sun, 6 Aug 2000 18:28:29 -0800, Michael Fowler wrote:
>>print $pw;
>>print scalar $pw;
>
>These resulting in a $pw->STRINGIFY or $pw->TO_STRING call is also
>confusing; neither are being used as strings.
Oh yes they are.
$^W = 1;
my $x;
print $x;
This compl
> Or just STRING. It's a verb to, you know ;-)
Yeah, I think this is best. SCALAR isn't real accurate anyways. I'll
change it in v2.
-Nate
On Sun, Aug 06, 2000 at 06:29:46PM -0700, Nathan Wiger wrote:
>print $pw;
This resulting in a $pw->SCALAR method call is confusing. $pw is not being
evaluated in scalar context.
>print $pw;
>print scalar $pw;
These resulting in a $pw->STRINGIFY or $pw->TO_STRING call is also
co
> >STRINGIFY would have my vote. "It's a string!!!". A string is a very
> >specific subtype of scalar.
>
> How about TO_STRING? Little less geeky.
AS_STRING. It doesn't convert, it translate.
Or just STRING. It's a verb to, you know ;-)
> How would this play with overload.pm?
At 04:02 AM 8/7/00 +0200, Bart Lateur wrote:
>STRINGIFY would have my vote. "It's a string!!!". A string is a very
>specific subtype of scalar.
How about TO_STRING? Little less geeky.
How would this play with overload.pm? What if that also specifies a
stringify routine? Which one should win?
On Sun, 06 Aug 2000 17:20:06 -0700, Nathan Wiger wrote:
>I'm not against other names. You're right, STRINGIFY has a ring to it,
>but I worry it might be too catchy for its own good? Not sure.
>
>The reason I thought SCALAR was good was because of this:
>
>print scalar $object;
>
>If this call
> I'm ashamed that this feature would mess with my (bad?) habit of
> re-writing "$pw" to just $pw on the assumption that whoever wrote
> it didn't know what the hell he was doing. Would anybody else be
> caught like that?
I'm not sure it would. I think if we did it right all of these could
potent
Nathan Wiger wrote:
>$pw = getpwnam('nwiger');
>print "$pw"; # calls $pw->SCALAR, which prints 'nwiger'
>die "Bad group" unless $pw->gid == 100;
I'm ashamed that this feature would mess with my (bad?) habit of
re-writing "$pw" to just $pw on the assumption that whoever wrote
> Larry's commented (in p5p) on his own experience in trying to
> have properly "stringified" objects. He wound up with a bunc of
> classes doing exactly what you suggest, which is using the
> existing overload mechanism *for just that one operation*. He
> speculated then that this particular on
> I don't see in here how an object tells the difference between being in
> scalar context and being in string context.
Think tie(). It wouldn't necessarily be the object that makes the
decision.
> for anything that wants to take such a relatively odd action.
As Spider notes, this isn't really
On Sun, 06 Aug 2000 16:43:36 -0700, Peter Scott wrote (in part):
Peter> Call me old-fashioned, but I don't see what's wrong with
Peter> use overload '""' => sub { $_[0]->to_string };
Peter> for anything that wants to take such a relatively odd
Peter> action.
Larry's commented (in p5p) on his o
> Objects should have builtin string SCALAR method
>
Sorry if I'm just being dumb, but... don't we already have this by
overloading the stringifying operator q{''}? How is the proposed SCALAR
method different?
At 11:36 PM 8/6/00 +, you wrote:
>I suggest that objects provide a default method called C that
>determines what they produce in a scalar context. When stringified, an
>object would automatically call its C function and return the
>correct value.
I don't see in here how an object tells the di
This and other RFCs are available on the web at
http://dev.perl.org/rfc/
=head1 TITLE
Objects should have builtin string SCALAR method
=head1 VERSION
Maintainer: Nathan Wiger <[EMAIL PROTECTED]>
Date: 06 Aug 2000
Version: 1
Status: developing
Mailing List: [EMAIL PROTECTED]
14 matches
Mail list logo