develooper Front page | perl.perl5.porters | Postings from August 2023

Re: PrePPC - builtin::stringify, builtin::numify

Thread Previous | Thread Next
Sam Kington
August 31, 2023 23:23
Re: PrePPC - builtin::stringify, builtin::numify
Message ID:
On 31 Aug 2023, at 16:56, Paul LeoNerd Evans <> wrote:
> We feel that these are weird cornercases that ideally should behave in
> a more flexible, predictable and consistent manner. It suggests that it
> would be nice to have a real builtin function to request that a value
> get squashed down to a plain string - by invoking the '""' overload if
> necessary. There's already a core OP_STRINGIFY to invoke here, so it
> seems simple enough to wrap it as a new builtin - builtin::stringify.
> If perl provided such a stringify function, then in the presence of the
> "please make join respect overloading" flag that one-argument
> specialcase can be removed, as now that special behaviour is no longer
> required.

Frankly, I want this anyway, because I’m tired of remembering whether $some_object->method->other_method->some_other_object wants to be stringified with ->to_string, ->as_string, ->stringify or whatever.

(And because the object is something I got as a result of a bunch of method calls, I can’t just wrap it in double quotes, because interpolation won’t kick in.)


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About