<div dir="ltr">A thought occurred to me that I could override the instance method `doesNotUnderstand` in a class to avoid writing a bunch of basic accessor methods. Setting aside whether it's ever a good idea to have a getter and setter method for every instance variable in a class, I thought I could do it like this:<div><br></div><div><font face="monospace">doesNotUnderstand: aMessage<br>    "gets or sets an instance variable"<br><br></font><span style="font-family:monospace">   <span class="gmail-Apple-converted-space"> </span></span><font face="monospace">| argCount getters key setters value |<br>    <br></font><span style="font-family:monospace">   <span class="gmail-Apple-converted-space"> </span></span><font face="monospace">argCount := aMessage numArgs.<br></font><span style="font-family:monospace">   <span class="gmail-Apple-converted-space"> </span></span><font face="monospace">argCount > 1 ifTrue: [ ^super doesNotUnderstand: aMessage ].<br><br></font><span style="font-family:monospace">   <span class="gmail-Apple-converted-space"> </span></span><font face="monospace">key := aMessage keywords first.<br></font><span style="font-family:monospace">   <span class="gmail-Apple-converted-space"> </span></span><font face="monospace">getters := self class allInstVarNames.<br></font><span style="font-family:monospace">   <span class="gmail-Apple-converted-space"> </span></span><font face="monospace">setters := getters collect: [ :name | name, ':' ].<br></font><span style="font-family:monospace">   <span class="gmail-Apple-converted-space"> </span></span><font face="monospace">(getters, setters includes: key) ifFalse: [ ^super doesNotUnderstand: aMessage ].<br>  <br></font><span style="font-family:monospace">   <span class="gmail-Apple-converted-space"> </span></span><font face="monospace">argCount = 0 ifTrue: [ ^self perform: key ].<br>     <br></font><span style="font-family:monospace">   <span class="gmail-Apple-converted-space"> </span></span><font face="monospace">value := aMessage arguments first.<br></font><span style="font-family:monospace">   <span class="gmail-Apple-converted-space"> </span></span><font face="monospace">self perform: key with: value</font><br><div><br></div><div>But this goes into an infinite loop because sending the `perform:` message ends up hitting `doesNotUnderstand` again. Is there a way I could make this work?</div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><font face="arial, helvetica, sans-serif">R. Mark Volkmann</font></div><div><span style="font-size:12.8000001907349px"><font face="arial, helvetica, sans-serif">Object Computing, Inc.</font></span></div></div></div></div></div></div></div></div></div></div>