From: Robert Klemme Date: 2003-05-17T01:00:03+09:00 Subject: Re: public/protected/private syntax "Guillaume Marcais" schrieb im Newsbeitrag news:B0000560431@smtp.rapiddsl.net... > On Friday 16 May 2003 03:38 am, you wrote: > > Can you explain that? What do you mean by "don't fit"? > > I find it more convenient when the scope of the method is directly readable > from the declaration of the method. In Java, public/protected/private are > qualifiers: > > private int dontcallme(); Yes, I like that approach, too. > In ruby, I need a second line to specify the scope of the method. Or the > default scope was change before the method declaration. In both cases I have > to look around the code to find what the scope of the method is. Well, nobody stops you using a "private" et al like in Java directly before each method. So in effect you want to force others to use this pattern (either by enforcing a modifier or by using underscores). I doubt you will convince a lot of people though. > With variables, the name only gives me all that information. It took me a > little while to get used to it (I was more used to the $ used the shell way, > to retrieve the value of the variable), I finally find it very convenient. I > was wondering if a similar concept could work with methods. > > Nevertheless, I do realize that what I proposed would break many existing > code. I just threw the idea to see what people think of it, if there is a way > to make it fly. If not, I can live very well with the existing mechanism :) Fine. :-) > I also notice that the ProgrammingRuby documentation, for example, doesn't > specify which methods are plublic, protected or private. Is the scope of > methods not considered important in Ruby? On the other hand, changing the > documentation doesn't need such a dramatich syntax change as the one I > proposed :) :-)) robert