<div dir="ltr">Do we really need ProtoObject?<div><br></div><div>For clever proxies implementation it is not needed and in some cases it can&#39;t be reused.</div><div>In Ghost we can specify concrete meta level with specific set of known messages. It is based on composition (not inheritance). </div><div><br></div><div>So if we don&#39;t need ProtoObject for proxies for what purpose we need it?</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-03-24 7:43 GMT+01:00 stepharo <span dir="ltr">&lt;<a href="mailto:stepharo@free.fr" target="_blank">stepharo@free.fr</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br>
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    In pharo 60 we will revisit and shrink protoObject.<br>
    <br>
    Stef<br>
    <br>
    <div>Le 15/2/16 19:34, Eliot Miranda a
      écrit :<br>
    </div>
    <blockquote type="cite">
      <pre> </pre>
      <br>
      <fieldset></fieldset>
      <br>
      <div dir="ltr">Hi Stef,
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Mon, Feb 15, 2016 at 8:18 AM,
            stepharo <span dir="ltr">&lt;<a href="mailto:stepharo@free.fr" target="_blank">stepharo@free.fr</a>&gt;</span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"> Hi eliot<br>
                <br>
                I think that the difference is really what guillermo
                explained. <br>
                With DNU you can only trapped methods that are not
                defined while if you want to implement true proxy you do
                not want holes.<br>
                I think that also with DNU proxy there were some limits
                realyed to classe but I do not remember.<br>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>As far as the VM goes, there is /one/ minor issue with
              special selector #== and #class (*).  But the real issue
              is that ProtoObject implements far too much protocol.  If
              one creates a class that inherits from nil all it needs to
              do is implement doersNotUnderstand: and it will catch
              every message (*).  For this to work the debugger and
              basic inspectors must use the mirror primitives otherwise
              there will be infinite recursion of MNUs.</div>
            <div><br>
            </div>
            <div>Now the issue with special selector #== and #class is
              that these bytecodes are specified as no lookup.  So if
              one uses bytecodes 182 (#==) or 199 (#class) these operate
              without sending messages and will compare the object or
              answer the object&#39;s class without sending
              #doesNotUnderstand:.</div>
            <div><br>
            </div>
            <div>In the VW VM I added a flag so one could turn this
              behaviour off, and that&#39;s certainly easy to do in our VM. 
              Another approach is to have the bytecode compiler not send
              these.</div>
            <div><br>
            </div>
            <div>But given our VM it is certainly possible to use
              doesNotUnderstand: proxies, using a much slimmer class
              than ProtoObject.  In fact a good project would be to try
              and shrink ProtoObject until it provides the minimum,
              which would be a #doesNotUnderstand: method that raises an
              error that reminds the programmer that they need to
              implement their own doesNotUnderstand: handler in
              subclasses of ProtoObject.</div>
            <div> </div>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div bgcolor="#FFFFFF" text="#000000"> <br>
                Stef<br>
                <br>
                <div>Le 15/2/16 16:06, Eliot Miranda a écrit :<br>
                </div>
                <div>
                  <div>
                    <blockquote type="cite">
                      <div>Hi Denis,</div>
                      <div><br>
                        On Feb 15, 2016, at 6:53 AM, Denis Kudriashov
                        &lt;<a href="mailto:dionisiydk@gmail.com" target="_blank">dionisiydk@gmail.com</a>&gt;
                        wrote:<br>
                        <br>
                      </div>
                      <blockquote type="cite">
                        <div>
                          <div dir="ltr">
                            <div class="gmail_extra"><br>
                              <div class="gmail_quote">2016-02-15 15:32
                                GMT+01:00 Mariano Martinez Peck <span dir="ltr">&lt;<a href="mailto:marianopeck@gmail.com" target="_blank"></a><a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a>&gt;</span>:<br>
                                <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                  <div>As far as I can remember (this
                                    was about 4 years ago) The use of
                                    #cannotInterpret: was the only way
                                    to be able to intercept everything
                                    without breaking the system.
                                    Subclassing from ProtoObject make
                                    your proxy to understand some
                                    messages. Subclassing from nil was
                                    technically possible, but I found
                                    out the system would simply crash as
                                    it didn&#39;t know at all how to handle
                                    other subclasses of nil. Even with
                                    the debugging support I added as you
                                    can read in the paper. Maybe things
                                    have changed.</div>
                                  <div><br>
                                  </div>
                                  <div>If subclassing from nil does not
                                    break the system and you can still
                                    inspect, debug proxies, then sure,
                                    you can give a try to Ghost using
                                    #dnu rather than #cannotInterpret:.
                                    In fact, I would like to have a
                                    dnu-based approeach that is as
                                    reliable as it was #cannotInterpret:
                                    in the sense of how much I can
                                    intercept. With #cannotInterpret I
                                    could trap EVERYTHING (everything
                                    but #==) and then decide what to do.
                                    Subclassing from nil would get you
                                    there too if you make it work. </div>
                                </blockquote>
                              </div>
                              <br>
                              Actually I already implemented it many
                              yeas ago for Mocketry. But subclassing
                              from nil works correctly only in VW. I got
                              problems when porting it to Squeak (at
                              that time). </div>
                            <div class="gmail_extra">Now I want to give
                              DNU another chance. It will simplify logic
                              very much. It will remove strange
                              hierarchy of proxies which is needed for
                              trick but raises many questions.</div>
                          </div>
                        </div>
                      </blockquote>
                      <br>
                      <div>There is no reason in principle why
                        Squeak/Pharo should not be able to use MNU
                        proxies in the same way as VW.  The key is to <span style="background-color:rgba(255,255,255,0)">use

                          the mirror primitives in</span> basic
                        inspectors that are used to inspect the proxies
                        and in the debugger to simulate code.  Without<span style="background-color:rgba(255,255,255,0)"> the

                          mirror primitives many sends to a proxy are
                          likely to create an infinite recursion.  As
                          yet we don&#39;t have a robust low space handler
                          that catches infinite recursion so debugging
                          can be frustrating.  But we can work on this. 
                          IMO the MNU approach is to be preferred.</span></div>
                    </blockquote>
                    <br>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div>
            <div dir="ltr">
              <div><span style="font-size:small;border-collapse:separate">
                  <div>_,,,^..^,,,_<br>
                  </div>
                  <div>best, Eliot</div>
                </span></div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
  </div>

<br></blockquote></div><br></div>