Replies: 6 comments 10 replies
-
SHOUTY checksPer Damian regarding the "Shouty" checks:
There has been some disagreement over SHOUTY checks (some of this in private feedback on an original private discussion). Further, in reading through code examples in other languages, there are plenty of times where native checks seem perfectly fine. My final concern was that I knew someone would release a module providing different names for native checks: check int :isa(INT);
check hash :isa(HASH);
# and so on Given the user can (and will) trivially subvert the check names, it seems to make sense to go for names that are the least contentious. That being said, the container checks (such as TitlecasedHaving built-in checks be title-cased ( my Int $foo = 0;
my int64 $foo = 0; # using native types for raw performance I'm not sure about the latter comment, but it seems like it could be a huge win in the long term. That being said, if possible, that's post-MVP and not something to bikeshed now unless it impacts current design. Lower-caseI am concerned about throwing up impediments to people using checks in the first place. Further, the more our check system will feel familiar to programmers from other languages. Thus, lower-case built-in checks would (sort of) map to what languages such as Java does. For example, with Java, you have primitive data types ( In fact, for many common languages, native types are all lower-case.
So encouraging a familiar style and not discouraging checks via "SHOUTY" could be valuable. |
Beta Was this translation helpful? Give feedback.
-
@druud @happy-barney @perigrin @rabbiveesh @rwp0 @SysPete @tobyink @demerphq A poll! Hopefully this will make some decisions clearer. |
Beta Was this translation helpful? Give feedback.
-
If anyone else can comment/vote, I'd appreciate it 😃 |
Beta Was this translation helpful? Give feedback.
-
(over) thinking: |
Beta Was this translation helpful? Give feedback.
-
I think i lean towards SHOUTY, TitleCased, lower_case in that order. Damian Conways argument about disaffordance makes sense to me. |
Beta Was this translation helpful? Give feedback.
-
I feel that for type or check names the best practice is to use the same naming pattern for system-defined and user-defined ones. What is good for one is good for the other. For all of the above I specifically recommend Title_Snake_Case. But also there should be no restrictions on user-defined type name styles, users should be able to use any valid Perl identifier syntax for their check names, including ones that use the same style as system-defined ones. Distinguishing system-defined ones should be done in some other way, like how we have builtin:: now, and CORE:: historically, as a disambiguator where needed. |
Beta Was this translation helpful? Give feedback.
-
There are several different ways the case of the data checks could be applied. We have built-in data checks and user-defined checks.
Given that all of the built-in checks are conceptually a single work (with the possible exception of
NONREF
), the casing on them isn't particularly impacted byCamelCase
.HASH
PositiveInt
Hash
positiveInt
hash
PositiveInt
12 votes ·
Beta Was this translation helpful? Give feedback.
All reactions