Hi,

is it possible to accept a method without creating instance variable?

E.g.

~~~~~~~~~~~~~~~~~~~~~~~~~~
Object subclass: #MyObject
        slots: {  }
        classVariables: {  }
        category: 'Category'
~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~
MyObject>>addValue: aValue
        container add: aValue
~~~~~~~~~~~~~~~~~~~~~~~~~~

Now normally when I would try to compile the method I would get the "Unknown 
variable 'container'" warning that will force me to either create temporary or 
instance variable; I would like to somehow ignore that, because the method will 
actually never get called.

My objective is use this method as a template for code generation, so I would 
then take this method, apply some code transformation and compile it into 
different object.

Of course I could do

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MyObject>>addValueTemplate
        ^ 'MyObject>>addValue: aValue
                container add: aValue'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

But then I would lose code highlighting, which is quite error-prone for more 
complex snippets.

If you have a better approach, I am all ears. :)

Thanks,
Peter


Reply via email to