简体   繁体   中英

Proper way to get all installed methods in Pharo

Sometimes you want to analyze all the methods in the image. One way to do this is to work with CompiledMethod allInstances . But it is dangerous to do it this way, as

  1. You may end up with old methods that were not garbage-collected yet.
  2. There may be compiled methods of anonymous classes or other instances that are there for technical reasons.

A dialect independent expression would be

ProtoObject withAllSubclasses gather: [:cls |
  cls methodDictionary values asArray,
    cls class methodDictionary values asArray]

我想到的一件事是:

RPackage organizer packages flatCollect: #methods 

我建议使用SystemNavigation ,它是为此设计的类:

SystemNavigation default allMethodsSelect: [:m | true]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM