Using # instead of. in the API documentation

In the API documentation and sometimes even used in discussions here on Stack Overflow, sometimes I see a pound symbol (#) instead of a period (.) As a separator between the class name and the method name. For instance:

Settings#maxPageSize

      

I'm wondering what this means and where does it come from?

+2


a source to share


2 answers


I have always thought that the difference is that it Settings.maxPageSize

seems to imply that you can actually write exactly that (that is, that it is a static method), and that the pound in there means that it is just a reference to the method, not to the piece of code you can execute.

Although I could be wrong about this =)

So, for static methods, you can actually reference them Settings.maxPageSize

, but methods, for example, you will have the opportunity to come up with a new convention, for example Array#sort

to indicate that something special is happening, or to achieve the same completeness, you have to write



myArray.sort // when myArray is of the type Array

      

EDIT

Amadan's answer seems to confirm my interpretation, except that it is Settings.maxPageSize

also not used for static methods; rather, it will be Settings::maxPageSize

, but .

will be reserved entirely, for example by code, which makes sense to me.

+3


a source


Assuming you mean Ruby (which is the first language I can think of with conventions like this), here's the explanation:



Why are methods in the Ruby documentation preceded by a hash sign?

+3


a source







All Articles