Sending a method 'nil'.. generates an error

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

Sending a method 'nil'.. generates an error

Rick Flower
I'm porting some code to generate RTF's from a set of
code I found for Squeak.. It converted OK but when I
run it I get this from gst :

gst ./source.gst
"Global garbage collection... done"
Loading package SUnit
./source.gst:4075: sending `nil', most likely you forgot a period

The method in question is this :

default [
   "set the receiver with the default format."

   <category: 'settings'>
  ^self nil
]

...

nil [
   "Set the receiver with this format"

   <category: 'settings'>
   ^self name: 'nil'
]

Aside from renaming the 'nil' method to something
else (e.g. nile), is there a way to keep gst happy
with this code?

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Sending a method 'nil'.. generates an error

Paolo Bonzini-2
On 06/18/2010 02:36 AM, Rick Flower wrote:
> I'm porting some code to generate RTF's from a set of
> code I found for Squeak.. It converted OK but when I
> run it I get this from gst :
>
> Aside from renaming the 'nil' method to something
> else (e.g. nile), is there a way to keep gst happy
> with this code?

It's a warning, you don't really care.

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Sending a method 'nil'.. generates an error

Rick Flower
On Fri, 18 Jun 2010 09:34:00 +0200, Paolo Bonzini <[hidden email]> wrote:

> On 06/18/2010 02:36 AM, Rick Flower wrote:
>> I'm porting some code to generate RTF's from a set of
>> code I found for Squeak.. It converted OK but when I
>> run it I get this from gst :
>>
>> Aside from renaming the 'nil' method to something
>> else (e.g. nile), is there a way to keep gst happy
>> with this code?
>
> It's a warning, you don't really care.

Thanks Paolo..

I actually renamed the method for now and got past
that issue.. The next issue is with a missing
definition for #sourceString -- not sure what that
might be.. Any ideas?  Below is a snippet of test
code using this :

table := RTFTableModel
  sending: #(#yourself #sourceString) , (Array with: nil)
  to: (testClass selectors asArray
      collect: [:sel | testClass compiledMethodAt: sel])
  labels: #('Selector' 'Source code') , (Array with: [Time now
printString]).

I'm guessing it's some way to get the source for
a method perhaps?  I'll probably disable it for now
or change the test code to not use that.. This is
probably a Squeakism that may not directly port over
to GST.. ?

Thx!

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Sending a method 'nil'.. generates an error

Paolo Bonzini-2
On 06/18/2010 05:33 PM, Rick Flower wrote:

> I actually renamed the method for now and got past
> that issue.. The next issue is with a missing
> definition for #sourceString -- not sure what that
> might be.. Any ideas?  Below is a snippet of test
> code using this :
>
> table := RTFTableModel
>    sending: #(#yourself #sourceString) , (Array with: nil)
>    to: (testClass selectors asArray
>        collect: [:sel | testClass compiledMethodAt: sel])
>    labels: #('Selector' 'Source code') , (Array with: [Time now
> printString]).
>
> I'm guessing it's some way to get the source for
> a method perhaps?  I'll probably disable it for now
> or change the test code to not use that.. This is
> probably a Squeakism that may not directly port over
> to GST.. ?

That would be #methodSourceString (for some strange historical reason)
in GST.

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Sending a method 'nil'.. generates an error

Rick Flower
On Fri, 18 Jun 2010 18:24:58 +0200, Paolo Bonzini <[hidden email]> wrote:

> On 06/18/2010 05:33 PM, Rick Flower wrote:
>> I actually renamed the method for now and got past
>> that issue.. The next issue is with a missing
>> definition for #sourceString -- not sure what that
>> might be.. Any ideas?  Below is a snippet of test
>> code using this :
>>
>> table := RTFTableModel
>>    sending: #(#yourself #sourceString) , (Array with: nil)
>>    to: (testClass selectors asArray
>>        collect: [:sel | testClass compiledMethodAt: sel])
>>    labels: #('Selector' 'Source code') , (Array with: [Time now
>> printString]).
>>
>> I'm guessing it's some way to get the source for
>> a method perhaps?  I'll probably disable it for now
>> or change the test code to not use that.. This is
>> probably a Squeakism that may not directly port over
>> to GST.. ?
>
> That would be #methodSourceString (for some strange historical reason)
> in GST.

Thanks.. Interestingly enough I found the generated RTF
appears to be invalid as MS-Word does not like it and
the general format it uses doesn't match examples in the
RTF Wikipedia page.. Oh well.. Not sure I'll have time to
retrofit this code afterall..   If someone else wants it,
I'll hand it over.. Time to head back over to the icky
land of 'Perl'.. Eww!

_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk