develooper Front page | perl.perl5.porters | Postings from June 2022

Pre-RFC: yield true feature

Thread Next
From:
Neil Bowers
Date:
June 6, 2022 22:06
Subject:
Pre-RFC: yield true feature
Message ID:
a026bc46-7aa9-4fbd-a26c-892b98454cef@Spark
This is a retrospective Pre-RFC for a proposal from Curtis, for which he submitted a draft RFC[1]. We nearly missed it when reviewing proposals in-flight in our PSC meeting last week, and decided to trigger a discussion here, to reinforce the process.

Beginning and casual Perl programmers regularly get confused / caught out by the requirement to add `1;` at the end of their modules. To add to their confusion, there are plenty of modules on CPAN with humorous alternatives for "1".

Curtis proposed a feature called something like yield_true, which would result in the current file yielding a true value on successful compilation. So a module could then look like this:

	package Zork;
	use feature 'yield_true';

	# code

This is not a feature we’d expect people to use explicitly, but would be part of the version bundle, so you’d get it for free with a future `use v5.XY`.

There’s a module called `true` on CPAN, which provides this[2].

Would this start off experimental? Hopefully not.

Neil

[1] https://github.com/Perl/RFCs/pull/16
[2] https://metacpan.org/pod/true

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About