Perl / PPCs

This repository is for Requests For Comments - proposals to change the Perl language.
61 stars 22 forks source link

Initial attempt at writing a PPC for custom prefix and postfix operators #51

Open leonerd opened 2 months ago

leonerd commented 2 months ago

A reminder on the PPC process: Accepting this PR means we like the document, but it does not automatically imply that we accept the idea embodied by it. Accepting the document first is useful as it gives it a number and allows us to discuss and iterate on one canonical version of it, ahead of accepting the underlying idea. It is perfectly fine to accept the document even if questions and issues still surround it.

In particular, given the lack of enthusiasm in this idea thus far, it may be worth accepting the PR purely to have a place to discuss whether it is even worth doing at all, accepting that we may ultimately end up rejecting it. At least this will serve as a discoverable place to document why.

book commented 1 month ago

If I remember correctly, you said on p5p something to the effect of "writing this PPC conviced me it wasn't worth it".

Should we close the PR as it is?

leonerd commented 1 month ago

I don't think we should close it entirely. It's still a useful suggestion of how to add such a feature if there was a compelling reason to do so. Perhaps instead I should adjust the wording to say "at the moment we don't have a strong enough case to actually do this, so it remains unimplemented".

ajmetz commented 1 month ago

I was gonna say - isn't custom pre and post stuff available via chaining custom methods, which basically is akin to the "existing function-call notation" mentioned in the PPC. That said, your example of √($x² + $y²) is very cool and neat, even if you immediately show the same can currently be done with sqrt($x**2 + $y**2) and there isn't enough justification yet for implementing this PPC. I must try out the cool infix stuff at some point though, =).