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

Builtin functions: Should they be snake_case?

Thread Next
From:
Paul "LeoNerd" Evans
Date:
March 4, 2022 15:37
Subject:
Builtin functions: Should they be snake_case?
Message ID:
20220304153648.7f553c04@shy.leonerd.org.uk
The first few functions I added to `builtin` were direct copies in
behaviour and name from the equivalents in Scalar::Util, or
newly-invented for the boolean feature. Among them are functions named
`isweak` and `isbool`. These names don't have underscores.

Core perl also seems to eschew the underscore, having many core
operators as direct copies of the same named system calls from POSIX or
similar.

There are recent suggestions of adding new `builtin` functions with
names like

  was_originally_string
  was_originally_builtin
  looks_like_number

I think therefore I'd like to suggest renaming the existing `isweak`
and `isbool` functions before people start using them, to `is_weak` and
`is_bool`.

What I'll probably do is rename them to having underscores in their
names anyway, but provide a wrapper alias in case people have started
writing code on those names. We can remove the wrapper at some later
time - because these are all "experimental" anyway and they're still
very new.

I'd also like to suggest that the naming scheme for new additions going
forward should be to use snake_case, even for such prefixes as "is_".


Thoughts anyone?

-- 
Paul "LeoNerd" Evans

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

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