fileOut & methodCategory

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

fileOut & methodCategory

Gnu mailing list
Hello,

I was wondering if someone may have run into the following issue.

In the test below, the method's category has been set after the method
had been defined. Should it be expected the method's new category to be
filed out with the method's block?

st> Object subclass: #Test.
my.Test

st> Test extend [
st>   test [
st>     self subclassResponsibility 
st>   ]
st> ]

st> (Test >> #test) methodCategory: 'test'.
Test>>test

st> (Test >> #test) methodCategory.
'test'

st> Test fileOutOn: stdout.
"Filed out from GNU Smalltalk version 3.2.5 on 6-Feb-2021 18:17:35"

Smalltalk.Object subclass: Test [
    
    <category: nil>
    <comment: nil>

    test [
    self subclassResponsibility 
  ]
]

If the behavior above is expected, would it be possible to do some sort
of refresh/decompilation before executing the fileOut?

Also, would there be a better way to fileOut all classes in a namespace
/ package?

Thanks in advance,
   Quenio
Reply | Threaded
Open this post in threaded view
|

Re: fileOut & methodCategory

stes


Hello Quenio,

I can reproduce what you report.

I believe that the fileOutOn: requires the "Parser" package.

st> PackageLoader fileInPackage: 'Parser'.

is required according to the documentation (and to make it actually fileOut).

When I use the fileIn: method it works for me:

With a small file "test.st" :

# cat test.st
!Test methodsFor: 'test'!
test
         self subclassResponsibility! !

and then:

    FileStream fileIn:'test.st' !


When I fileOut then:

st> Test fileOutOn: stdout.

    test [
        <category: 'test'>
        self subclassResponsibility
    ]

So in that case <category: 'test'> is in the output.

Regards,
David Stes

----- Op 6 feb 2021 om 19:28 schreef help-smalltalk [hidden email]:

> Hello,
>
>
>
> I was wondering if someone may have run into the following issue.
>
>
>
> In the test below, the method's category has been set after the method
>
> had been defined. Should it be expected the method's new category to be
>
> filed out with the method's block?
>
>
>
> st> Object subclass: #Test.
>
> my.Test
>
>
>
> st> Test extend [
>
> st>   test [
>
> st>     self subclassResponsibility
>
> st>   ]
>
> st> ]
>
>
>
> st> (Test >> #test) methodCategory: 'test'.
>
> Test>>test
>
>
>
> st> (Test >> #test) methodCategory.
>
> 'test'
>
>
>
> st> Test fileOutOn: stdout.
>
> "Filed out from GNU Smalltalk version 3.2.5 on 6-Feb-2021 18:17:35"
>
>
>
> Smalltalk.Object subclass: Test [
>
>    
>
>    <category: nil>
>
>    <comment: nil>
>
>
>
>    test [
>
>    self subclassResponsibility
>
>  ]
>
> ]
>
>
>
> If the behavior above is expected, would it be possible to do some sort
>
> of refresh/decompilation before executing the fileOut?
>
>
>
> Also, would there be a better way to fileOut all classes in a namespace
>
> / package?
>
>
>
> Thanks in advance,
>
>    Quenio

Reply | Threaded
Open this post in threaded view
|

Re: fileOut & methodCategory

Gnu mailing list
Thanks for checking it, David.

It seems the problem occurs when defining a class interactively in the
shell, and using the methodCategory: method.

On February 10, 2021, "[hidden email]" <[hidden email]> wrote:

> Hello Quenio,
>
> I can reproduce what you report.
>
> I believe that the fileOutOn: requires the "Parser" package.
>
> st> PackageLoader fileInPackage: 'Parser'.
>
> is required according to the documentation (and to make it actually
> fileOut).
>
> When I use the fileIn: method it works for me:
>
> With a small file "test.st" :
>
> # cat test.st
> !Test methodsFor: 'test'!
> test
>  self subclassResponsibility! !
>
> and then:
>
>  FileStream fileIn:'test.st' !
>
>
> When I fileOut then:
>
> st> Test fileOutOn: stdout.
>
>  test [
>  <category: 'test'>
>  self subclassResponsibility
>  ]
>
> So in that case <category: 'test'> is in the output.
>
> Regards,
> David Stes
>
> ----- Op 6 feb 2021 om 19:28 schreef help-smalltalk help-
> [hidden email]:
>
> > Hello,
> > 
> > 
> > 
> > I was wondering if someone may have run into the following issue.
> > 
> > 
> > 
> > In the test below, the method's category has been set after the
> method
> > 
> > had been defined. Should it be expected the method's new category to
> be
> > 
> > filed out with the method's block?
> > 
> > 
> > 
> > st> Object subclass: #Test.
> > 
> > my.Test
> > 
> > 
> > 
> > st> Test extend [
> > 
> > st>   test [
> > 
> > st>     self subclassResponsibility
> > 
> > st>   ]
> > 
> > st> ]
> > 
> > 
> > 
> > st> (Test >> #test) methodCategory: 'test'.
> > 
> > Test>>test
> > 
> > 
> > 
> > st> (Test >> #test) methodCategory.
> > 
> > 'test'
> > 
> > 
> > 
> > st> Test fileOutOn: stdout.
> > 
> > "Filed out from GNU Smalltalk version 3.2.5 on 6-Feb-2021 18:17:35"
> > 
> > 
> > 
> > Smalltalk.Object subclass: Test [
> > 
> >    
> > 
> >    <category: nil>
> > 
> >    <comment: nil>
> > 
> > 
> > 
> >    test [
> > 
> >    self subclassResponsibility
> > 
> >  ]
> > 
> > ]
> > 
> > 
> > 
> > If the behavior above is expected, would it be possible to do some
> sort
> > 
> > of refresh/decompilation before executing the fileOut?
> > 
> > 
> > 
> > Also, would there be a better way to fileOut all classes in a
> namespace
> > 
> > / package?
> > 
> > 
> > 
> > Thanks in advance,
> > 
> >    Quenio