Caps for named patterns

In embedded Mathematica characters, capital letters begin. Therefore, it is customary to practice not starting user-created character names in capital letters.

How far will this restriction extend to other aspects of the syntax? Does good practice SetDelayed that the capital letter is not used for the named template in the SetDelayed or RuleDelayed (where such names are localized)?

I think capitals expand the namespace in a useful way and, for example, visually distinguish lowercase letters L and 1. They also resolve argument names in the textbook.

If new characters are introduced in future versions, named patters should replace them, and existing code should not be interrupted.

The console is ambiguous if existing names such as N and D , but I feel that both the context of use and FrontEnd syntax highlighting mitigate this.

+7
source share
1 answer

This is an accepted practice that I do not accept!

I mean packages for personal or third-party use. In general, I want my finished work to be as indistinguishable from ideal (WRI) quality, appearance and perception. This includes long descriptive names for my teams, with all the capitalization conventions used in the WRI.

Of course, my packages - at the moment - are nowhere near WRI quality, but at least I'm trying to integrate them as best as possible with standard MMA features. And that includes heading teams.

During development, syntax highlighting warns me of potential conflicts with standard MMA functions, so I can take appropriate action. Of course, my commands and packages may conflict with future versions of MMA, but nothing lasts forever, and if the future MMA command is similar in name and functionality to mine, I just switch to a standard function with minimal or no naming change.

In addition, I find it visually much more attractive to use capitalization to distinguish package commands from more modest temporary variables. If you want to see some visually opaque / unattractive code, just look at any middle Maple code.

As for the template variables, I try to give meaningful, mostly short, template names without capital, so the user can guess by looking at the Ctrl / Cmd-K template what type of input is expected in my package commands.

+2
source

All Articles