File out compiled methods?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

File out compiled methods?

Schwab,Wilhelm K
Hello all,

I see how to file out methods (Migrate does it with the safe/dangerous
selector stuff), but it looks a little complicated.  Is there (or should
there be) a way to pass one or more compiled methods to a filer and let
it handle the details?

The code in Migrate is a little mysterious looking, but I suspect it was
a D4/D5 compatibility trick (I'd know if I had commented it).

Have a good one,

Bill


--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: File out compiled methods?

Schwab,Wilhelm K
Hello all,

> I see how to file out methods (Migrate does it with the safe/dangerous
> selector stuff), but it looks a little complicated.

Having an example to follow, it was trivial (see below).  I doubt it
would be so obvious trying it from scratch.  Any takers for a cleanup,
or is it good enough as is?

Have a good one,

Bill

==============

| out methods filer |
out := String writeStream.
methods := SmalltalkSystem current definitionsOf:#readFrom:for:.
filer := ChunkSourceFiler on:out.
methods do:[ :each |
        filer
                fileOutMessages:( Array with:each selector )
                ofBehavior:each methodClass.
].
SmalltalkWorkspaceDocument show streamIn:out contents readStream.

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: File out compiled methods?

Blair McGlashan-3
"Bill Schwab" <[hidden email]> wrote in message
news:cv0uf6$12ni$[hidden email]...
> Hello all,
>
>> I see how to file out methods (Migrate does it with the safe/dangerous
>> selector stuff), but it looks a little complicated.
>
> Having an example to follow, it was trivial (see below).  I doubt it would
> be so obvious trying it from scratch.  Any takers for a cleanup, or is it
> good enough as is?

In D6 we have the method I've pasted below. This groups the methods by class
for efficiency and a repeatable ordering, which is useful when using
traditional file based source code control systems. I believe it was
extracted from the package systems file out of loose methods.

Regards

Blair
----------------
!SourceFiler methodsFor!

fileOutMethods: aCollection
 "Append the definitions of the methods in the <collection> argument to the
source stream,
 ordered by class. Any method category settings are included."

 | methodsByClass |
 methodsByClass := Dictionary new.
 aCollection do:
   [:each |
   "Note that the selectors will be filed out in sorted order, so we don't
need to sort them"
   (methodsByClass at: each methodClass ifAbsentPut: [OrderedCollection
new]) add: each selector].
 (methodsByClass associations
  asSortedCollection: [:a :b | (a key name trueCompare: b key name) <= 0])
   do: [:each | self fileOutMessages: each value ofBehavior: each key]! !
!SourceFiler categoriesFor: #fileOutMethods:!public!source filing! !


Reply | Threaded
Open this post in threaded view
|

Re: File out compiled methods?

Schwab,Wilhelm K
Blair,

  > In D6 we have the method I've pasted below. This groups the methods
by class
> for efficiency and a repeatable ordering, which is useful when using
> traditional file based source code control systems. I believe it was
> extracted from the package systems file out of loose methods.

Thanks!!!!

Bill


--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

In D6....

talios@gmail.com
In reply to this post by Blair McGlashan-3
Blair McGlashan wrote:

>In D6 we have the method I've pasted below. This groups the methods by class
>for efficiency and a repeatable ordering, which is useful when using
>  
>
So...... when do us mere mortals get to see this famed D6? :)