Comment #95
can we be clearer in the specs about , #
| Status: | Open | Start: | 12/04/2009 | |
| Priority: | Normal | Due date: | ||
| Assigned to: | - | % Done: | 0% |
|
| Category: | - | |||
| Target version: | - | |||
| Clause: | (eg. 11.1.2) |
Page and Line: | (eg. 123:45) |
|
Description
Hi,
can we be clearer about the use of the "." or "#" ? It would have been good to clean that in the specs, so that going forward we use only one of them ? the "." is more universal with the advent of java and c#.
e.g object.method
the same would apply for "::", why don't we use just "." just like in other languages for all whether it's scope e.g module.module.class
besides it would save a keystroke everytime we use "." versus "::".
History
Updated by Shugo Maeda 278 days ago
CHRIS Howard wrote:
can we be clearer about the use of the "." or "#" ? It would have been good to clean that in the specs, so that going forward we use only one of them ? the "." is more universal with the advent of java and c#. e.g object.method
the same would apply for "::", why don't we use just "." just like in other languages for all whether it's scope e.g module.module.class besides it would save a keystroke everytime we use "." versus "::".
Do you mean that the syntax of Ruby should be changed to use "." instead of "::"?
We intend to describe the syntax and semantics of as-is existing implementation in the specification.
If you would like the syntax of Ruby to change, please post your idea to the ruby-core ML.
Updated by CHRIS Howard 241 days ago
Well there are 2 parts to my original comment:
1) to state very clearly in the specifications about the use of ".", "#", "::". when they should be used for. so that all those writers out there cause less confusion to new users. this will prevent everyone to use their own "standard".
I find that people are using them differently, just go through :-
"programming ruby 1.9" by dave thomas,
"ruby in a nutshell" by matz,
"ruby way"
etc...
everybody uses these signs in a different way. It's like a zoo, another example of the balkanization of the language, when even the main players are not on the same page.
2) to avoid confusion, then maybe we should just use "." for everything. ( I know for this one you referred me to the ruby core ml group)
Updated by Shugo Maeda 238 days ago
CHRIS Howard wrote:
Well there are 2 parts to my original comment:
1) to state very clearly in the specifications about the use of ".", "#", "::". when they should be used for. so that all those writers out there cause less confusion to new users. this will prevent everyone to use their own "standard".
I find that people are using them differently, just go through :- "programming ruby 1.9" by dave thomas, "ruby in a nutshell" by matz, "ruby way" etc... everybody uses these signs in a different way. It's like a zoo, another example of the balkanization of the language, when even the main players are not on the same page.
We are using "." and "#" for explanation purpose only in clause 15 "Built-in classes and modules", and their usage is described in subclause 15.1 "General description."
If you find other usage in the draft, please tell us.
2) to avoid confusion, then maybe we should just use "." for everything. ( I know for this one you referred me to the ruby core ml group)
We'd like to use "#" to distinguish instance methods from class methods.
I think it's not so confusing because its use is limited to subclase titles as described in 15.1.
Updated by CHRIS Howard 234 days ago
is it possible to add clearly in the standardization document, the syntax of how to access
1) an instance method ,
2) a class method,
3) a method in a module
4) a module constant
5) a class constant
I don't see that clearly in the document, or did I miss them ? In this way , everyone will use that syntax going forward. Otherwise, it's like on a street, some people are driving on the left, some people are driving on the right ? and nobody knows whether to drive on the right or left, and make their own laws. can you imagine the chaos that will cause ?
Updated by Shugo Maeda 232 days ago
CHRIS Howard wrote:
is it possible to add clearly in the standardization document, the syntax of how to access
1) an instance method , 2) a class method, 3) a method in a module 4) a module constant 5) a class constant
Do you mean that we should specify notations to describe these constructs in documentations?
As "1 Scope" of the draft specification says, the draft specifies the syntax and semantics of the Ruby programming language, not notations for documentations.
Updated by Bjorn De Meyer 232 days ago
Well, the specs do use # a lot to mean "instance method of class". Is that explained somewhere in the specs themselves?
Updated by Shugo Maeda 232 days ago
Bjorn De Meyer wrote:
Well, the specs do use # a lot to mean "instance method of class". Is that explained somewhere in the specs themselves?
It is described in subclause 15.1, and applies only to the draft specification.
We do not intend that other documentations should use the same notation.
Updated by Bjorn De Meyer 231 days ago
Though I suspect that it will also become somewhat of a documentation standard, since it's included in the language standard, I think it's OK since it's explained in the ssection you mentioned. I'll leave it at that.
Updated by Jörg W Mittag 202 days ago
Bjorn De Meyer wrote:
Though I suspect that it will also become somewhat of a documentation standard, since it's included in the language standard, I think it's OK since it's explained in the ssection you mentioned. I'll leave it at that.
Note that it is already pretty much a standard, and has been for quite some time. It's the standard convention in the YARV and MRI standard library documentation. It is also used in the documentation for pretty much every other Ruby library and gem.
And it's not just Ruby, either: the # sign is also used in JavaDoc to denote class members.
Updated by Shugo Maeda 201 days ago
Jörg W Mittag wrote:
Note that it is already pretty much a standard, and has been for quite some time. It's the standard convention in the YARV and MRI standard library documentation. It is also used in the documentation for pretty much every other Ruby library and gem.
Yes, it is why we used # to denote instance methods.
However, we ourselves don't aim to standardize notations for documentation.