From: Ryan Davis Date: 2012-08-15T14:02:27+09:00 Subject: Re: Idea: def ... end returns the symbolized version of the newly-defined method, instead of nil On Aug 14, 2012, at 7:41 PM, Peter wrote: > Not sure if you've ever worked on large classes in large Ruby/Rails projects (unless you want to count "possible code smell" as an argument against this, putting that aside for a moment) but if a "protected" or "private" block is fairly large, it gets difficult to see what's going on without doing "private :method_just_defined_on_previous_line" dozens of times (which to me is a different kind of smell, but some consider it a valid style). > > Since a symbol is already created when a method is defined, and we are dealing with a functional language (or one with functional aspects), I just think it would be useful for a def to return something other than "nil", and it would nicely dovetail with the fact that "protected" and "private" can take symbol arguments. There are no extra costs involved. > > > Personally, I've never found protected/private to be useful. > > Your anecdotal experience does not count as evidence towards utility. I didn't offer it as evidence. I offered it as an opinion. But since you want evidence of utility... There IS no utility to protected/private in ruby. All methods are callable. Always. > > Do note that your proposed "syntax" above is mostly achieved with 2 chars added: > > No, actually that only works for the case of 2 methods, one protected and one private. If you have 10 protected methods and 10 private methods, the situation quickly becomes more complicated. I hardly think that adding a semicolon N times is "complicated". Please. Stick to arguments that at least make sense. Again. Replace the ";" with a newline and it becomes obvious how this proposal doesn't provide much value.