2 added 278 characters in body
source | link

No. Dont make functions with names very similar to built-in functions, but which actually does the opposite. It may seem intuitive to you, but is going to be very confusing to other developers, and even to yourself some time in the future when you have more experience.

The meaning of max is "the maximum of", but your "intuitive" understanding is something like "to the maximum of". But itthis is totally fine to wrapsimply a built-in function in anotherwrong understanding of the function with a more specific, and changing the name forfrom max to maximum does not communicate your purposedifferent interpretation. Even if you strongly believe the language designers made a mistake, egdon't do something like this.

But changing the name to say cap(x, limit) as has been suggested would be fine, since it clearly does communicate the intention, even if it just wraps min.

No. Dont make functions with names very similar to built-in functions, but which actually does the opposite. It may seem intuitive to you, but is going to be very confusing to other developers, and even to yourself some time in the future when you have more experience.

But it is totally fine to wrap a built-in function in another function with a more specific name for your purpose, eg. cap(x, limit) as has been suggested.

No. Dont make functions with names very similar to built-in functions, but which actually does the opposite. It may seem intuitive to you, but is going to be very confusing to other developers, and even to yourself some time in the future when you have more experience.

The meaning of max is "the maximum of", but your "intuitive" understanding is something like "to the maximum of". But this is simply a wrong understanding of the function, and changing the name from max to maximum does not communicate your different interpretation. Even if you strongly believe the language designers made a mistake, don't do something like this.

But changing the name to say cap(x, limit) as has been suggested would be fine, since it clearly does communicate the intention, even if it just wraps min.

1
source | link

No. Dont make functions with names very similar to built-in functions, but which actually does the opposite. It may seem intuitive to you, but is going to be very confusing to other developers, and even to yourself some time in the future when you have more experience.

But it is totally fine to wrap a built-in function in another function with a more specific name for your purpose, eg. cap(x, limit) as has been suggested.