[BUG] Obsolete primitives?

Bert Freudenberg bert at isgnw.CS.Uni-Magdeburg.De
Tue Sep 7 07:35:21 UTC 1999


On Mon, 6 Sep 1999, Dan Ingalls wrote:

> >If anyone wants to explore Squeaks primitives you may use this code
> >snippet which opens a browser on all primitives:
> >
> >  | aColl method prim |
> >  aColl _ OrderedCollection new: 200.
> >  Cursor execute showWhile: [Smalltalk allBehaviorsDo: [:class |
> >    class selectorsDo: [:sel | 
> >      method _ class compiledMethodAt: sel.
> >      (method primitive ~= 0 and: [method isQuick not]) ifTrue: [
> >        prim _ String streamContents: [ :s |
> >          s nextPutAll: class name; space;
> >            nextPutAll: sel; space.
> >          method printPrimitiveOn: s].
> >        aColl addLast: method primitive -> prim]]].
> >    aColl _ aColl asSortedCollection collect: [:assoc | assoc value]].
> >  Smalltalk browseMessageList: aColl name: 'primitive messages'.
> 
> ... or simply ...
> 
>     Smalltalk browseAllSelect: [:m | m primitive ~= 0 and: [m isQuick not]]

Not that I want to argue with you, Dan, but my version does sorting and
shows the primitive number (or name and module for named prims) in the
list. Try to find the users of primitive 91 in your's ;-)

Anyway, there is a built-in method that at least shows the primitive
number:

Smalltalk browseMessageList: Smalltalk allPrimitiveMessages name: 'prims'

Cheers!

  /bert





More information about the Squeak-dev mailing list