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

Re: Thoughts Towards Type Assertions (was: Re: Pre-RFC: builtin::functions for detecting numbers vs strings)

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
February 25, 2022 16:40
Subject:
Re: Thoughts Towards Type Assertions (was: Re: Pre-RFC: builtin::functions for detecting numbers vs strings)
Message ID:
20220225164005.3089a19b@shy.leonerd.org.uk
On Fri, 25 Feb 2022 17:21:58 +0100
demerphq <demerphq@gmail.com> wrote:

> On Thu, 24 Feb 2022 at 17:31, Paul "LeoNerd" Evans
> <leonerd@leonerd.org.uk> wrote:
> 
> > At this point I suddenly don't even like the word "Type". But
> > currently I don't have a better one - words like "nature", "facet",
> > "ability" or "capability" all feel wrong somehow.
> >  
> 
> This reminds me of looks_like_a_number() which pops up all over the
> place. And I wonder if we even need to have a test for "looks like
> text", if we have tests for everything else then the only thing left
> is "text" (without getting into debates about whether the text is
> pure-octets, or unicode or whatever).

Yes; indeed when briefly discussing these "was originally
number/string" functions on the PSC call today, Rik mentioned
looks_like_a_number. It's quite similar on intent and naming scheme.

I also note that we don't (yet) have a builtin::looks_like_a_number so
perhaps there'd be scope for adding all three of these together, where
the documentation can point out to would-be users of
"was_originally_number" that they almost-certainly didn't want that
function and should instead consider "looks_like_a_number".

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

Thread Previous | 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