On Thu, Aug 05, 2021 at 01:35:19PM +0200, Salvador Fandi?o wrote:
> On 5/8/21 12:58, Paul "LeoNerd" Evans wrote:
>
> > I don't yet have a good thought about "no", but since PL_sv_yes carries
> > its own stringification PV, it's possible that sv_setsv could notice
> > it's that special value and store it as-is, with SvLEN == 0, into the
> > target. So it's now possible to distinguish any true bool value, by
> >
> > SvIV(sv) == 1 && SvPVX(sv) == SvPVX(&PL_sv_yes)
>
> That would impede one for having boolean dualvars.
>
> Programmers may want to have booleans that stringify as True/False, T/F,
> Yes/No, 1/0, or the current 1/"".
>
> Actually, I would say the current PL_sv_no stringification ("") is not the
> one the programmer needs in most cases.
I think that this is relevant discussion for an RFC proper, not this Pre-RFC
thread. Thanks for raising this potential problem early.
Consensus seems to be that having boolean values that know that they are
boolean values is worth an RFC. How we best implement it isn't obvious
without experimenting, and discovering the drawbacks of any approach.
Nicholas Clark
> On 5/8/21 12:58, Paul "LeoNerd" Evans wrote:
>
> > I don't yet have a good thought about "no", but since PL_sv_yes carries
> > its own stringification PV, it's possible that sv_setsv could notice
> > it's that special value and store it as-is, with SvLEN == 0, into the
> > target. So it's now possible to distinguish any true bool value, by
> >
> > SvIV(sv) == 1 && SvPVX(sv) == SvPVX(&PL_sv_yes)
>
> That would impede one for having boolean dualvars.
>
> Programmers may want to have booleans that stringify as True/False, T/F,
> Yes/No, 1/0, or the current 1/"".
>
> Actually, I would say the current PL_sv_no stringification ("") is not the
> one the programmer needs in most cases.
I think that this is relevant discussion for an RFC proper, not this Pre-RFC
thread. Thanks for raising this potential problem early.
Consensus seems to be that having boolean values that know that they are
boolean values is worth an RFC. How we best implement it isn't obvious
without experimenting, and discovering the drawbacks of any approach.
Nicholas Clark