On Tuesday, September 28, 2004, 11:11:19 AM, trans. wrote:

> On Monday 27 September 2004 08:09 pm, David A. Black wrote:
>> If so, I hope it won't have the boolean flag.  I think those flags,
>> such as instance_methods(false), etc., are the most obscure, cryptic
>> thing in Ruby.  I'd like to see them disappear.

> Actually, I agree with you too. Since it's just a flag, perhaps using
> meaningful symbols would be better?

>   methods(:public)
>   methods(:private)
>   methods(:protected)

>   methods(:no_ancestors)
>   methods(:ancestors_only)

>   methods(:class)        # same as self.class.methods ?
>   methods(:singleton)

> And they could be combined:

>   methods(:private, :protected)
>   methods(:singleton, :private)
>   methods(:private, :no_ancestors)

Nice idea.  I'm considering putting a bit of effort into an API for
querying the methods of an object.  It's an easy thing to do, but it's
gotta be done well.  Anyway...

  m = Methods["foo"]         # -> Methods object
  m.public
  m.protected
  m.private
  m.singleton
  m.no_ancestors
  m.ancestors_only
  m.class   # name clash :(

  m.public(:no_ancestors)
  m.singleton(:private)

  m.query(:public, :no_ancestors)
  m.query(:singleton, :private)

Then a similar thing for instance methods of a class/module.

  m = InstanceMethods[String]
  m.public
  ...

Just scratching for ideas at the moment.  Send them in!!

Gavin