<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div> </div>
<div> </div>
<div> </div>
<div>On Sat, Mar 15, 2014, at 05:36 AM, Stephen De Gabrielle wrote:<span style="display:none"></span><br></div>
<blockquote style="margin: 0px 0px 0px 4px;" type="cite"><div style="position: relative; font-family: Arial,helvetica,clean,sans-serif; font-size: 13px;"><div style="z-index: 1; line-height: 1.22em;"><div style="font-family: Georgia; line-height: 1.22em;"><div style="line-height: 1.22em;" dir="ltr"><div style="line-height: 1.22em;"><p style="margin: 0px; font-size: 11px; font-family: Menlo; line-height: 1.22em;">1. defining a method object doesn't seem to run it's code? (I don't get 'test' returned). Instead if I do 'lobby person5'. <br></p><p style="margin: 0px; font-size: 11px; font-family: Menlo; line-height: 1.22em;"> - Am I right that method objects only 'run' when called, and their slots only exist for the duration of their action?<br></p></div>
</div>
</div>
</div>
</div>
</blockquote><div style="position: relative; font-family: Arial,helvetica,clean,sans-serif; font-size: 13px;"><div style="z-index: 1; line-height: 1.22em;"><div style="font-family: Georgia; line-height: 1.22em;"><div style="line-height: 1.22em;" dir="ltr"><div style="line-height: 1.22em;"><div defang_dir="" class=""> </div>
<div defang_dir="" class="">Yes, that's right. Your method, person3, is created and added as a slot. It is called when you do "lobby person3". That method has local variables age, name and parent.<br></div>
<div defang_dir="" class=""> </div>
</div>
</div>
</div>
</div>
</div>
<blockquote style="margin: 0px 0px 0px 4px;" type="cite"><div style="position: relative; font-family: Arial,helvetica,clean,sans-serif; font-size: 13px;"><div style="z-index: 1; line-height: 1.22em;"><div style="font-family: Georgia; line-height: 1.22em;"><div style="line-height: 1.22em;" dir="ltr"><div style="line-height: 1.22em;"><p style="margin: 0px; font-size: 11px; font-family: Menlo; line-height: 1.22em;">2. method objects don't get an outliner - because they only exist as objects while they are running.<br></p></div>
</div>
</div>
</div>
</div>
</blockquote><div style="position: relative; font-family: Arial,helvetica,clean,sans-serif; font-size: 13px;"><div style="z-index: 1; line-height: 1.22em;"><div style="font-family: Georgia; line-height: 1.22em;"><div style="line-height: 1.22em;" dir="ltr"><div style="line-height: 1.22em;"><div defang_dir="" class="">Right. You can get an object representing the method using mirrors:<br></div>
<div defang_dir="" class=""> </div>
<div defang_dir="" class="">  (reflect: lobby') at: 'person3'<br></div>
<div defang_dir="" class=""> </div>
<div defang_dir="" class="">Browse through the methods on that in an outliner.<br></div>
<div defang_dir="" class=""> </div>
</div>
</div>
</div>
</div>
</div>
<blockquote style="margin: 0px 0px 0px 4px;" type="cite"><div style="position: relative; font-family: Arial,helvetica,clean,sans-serif; font-size: 13px;"><div style="z-index: 1; line-height: 1.22em;"><div style="font-family: Georgia; line-height: 1.22em;"><div style="line-height: 1.22em;" dir="ltr"><div style="line-height: 1.22em;"><p style="margin: 0px; font-size: 11px; font-family: Menlo; line-height: 1.22em;">
This seems to indicate I can't create an object that can do some setup code when it is created? Am I missing a trick?<br></p></div>
</div>
</div>
</div>
</div>
</blockquote><div style="position: relative; font-family: Arial,helvetica,clean,sans-serif; font-size: 13px;"><div style="z-index: 1; line-height: 1.22em;"><div style="font-family: Georgia; line-height: 1.22em;"><div style="line-height: 1.22em;" dir="ltr"><div style="line-height: 1.22em;"><div defang_dir="" class=""> </div>
<div defang_dir="" class="">This is often done with a variant of 'copy'. Eg. on an object you'd do:<br></div>
<div defang_dir="" class=""> </div>
<div defang_dir="" class="">  myobject copyWithSomeEffect: 'blah'.<br></div>
<div defang_dir="" class=""> </div>
<div defang_dir="" class=""> </div>
</div>
</div>
</div>
</div>
</div>
<blockquote style="margin: 0px 0px 0px 4px;" type="cite"><div style="color: #fff; height: 0;"> </div>
</blockquote></body>
</html>