Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Naming convention #2606

Answered by kgryte
svallory asked this question in Q&A
Jul 15, 2024 · 1 comments · 1 reply
Discussion options

Hey guys! Quick question...

Why are some functions camelCased while others are not? Like tryFunction/trycatch. Is there a rule behind it?

You must be logged in to vote

@svallory Thanks for opening this discussion. Where are you referring to, specifically? Documentation, namespace?

Looking at the docs and namespace, it does look like we are inconsistent here:

setReadOnly( utils, 'trycatch', require( '@stdlib/utils/try-catch' ) );
.

In this particular case, I don't think we have a rationale for diverging conventions. I'd be inclined to update trythen and trycatch to tryThen and tryCatch, as this seems preferable to tryfunction and tryrequire.

Replies: 1 comment 1 reply

Comment options

@svallory Thanks for opening this discussion. Where are you referring to, specifically? Documentation, namespace?

Looking at the docs and namespace, it does look like we are inconsistent here:

setReadOnly( utils, 'trycatch', require( '@stdlib/utils/try-catch' ) );
.

In this particular case, I don't think we have a rationale for diverging conventions. I'd be inclined to update trythen and trycatch to tryThen and tryCatch, as this seems preferable to tryfunction and tryrequire.

You must be logged in to vote
1 reply
Comment options

Great! Sticking to a convention helps newcomers a lot!

I was reading the documentation, and noticed there are several functions that don't follow the camelCase pattern and instead are all lowercase. safeintmin is another example.

There were enough that I thought there could be a reason. Even when there is, may I suggest adding aliases?

For example, if safeintmin is all in lowercase due to some historical or contextual reason, just add a alias safeIntMin

Answer selected by svallory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /