如何在Squeak Smalltalk中按作者全称或首字母查找其所有方法贡献?
在Squeak中按作者首字母/全称查看所有贡献内容
当然可以,Squeak提供了几种实用的方式来实现这个需求:
1. 用系统浏览器的内置搜索
打开System Browser后,在顶部的搜索区域:
- 点击搜索框旁的下拉菜单,选择
author作为搜索维度 - 输入目标作者的首字母或全称,系统会自动筛选出该作者提交的所有方法
- 注意:首字母匹配可能会命中多个作者,使用全称能获得更精确的结果
2. 通过Finder工具筛选
打开Finder(路径:World Menu > Open > Finder):
- 切换到
Methods标签页 - 点击搜索栏的
+按钮,添加author规则 - 填入作者的首字母或全称,点击搜索即可列出所有相关方法
3. 自定义代码遍历查找
如果需要更灵活的筛选,可以用一段Smalltalk脚本实现:
| targetAuthor matchedMethods | targetAuthor := 'JD'. "替换为目标作者的首字母或全称" matchedMethods := SystemNavigation default allMethods select: [:method | method author asLowercase includesSubstring: targetAuthor asLowercase]. "在Transcript中输出结果" matchedMethods do: [:method | Transcript show: method methodClass name, '>>', method selector; cr]. "或者直接在浏览器中打开所有匹配方法" Browser fullOnMethods: matchedMethods
内容的提问来源于stack exchange,提问作者kejster
相关产品推荐
相关产品推荐

