<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Sorry, I forgot to mention something:<br>
      <br>
      On 1/18/2015 7:26 PM, Ryan Macnak wrote:<br>
    </div>
    <blockquote
cite="mid:CAPSzXpw-ZvwZchXEXvm8Z6UFBR-JpfVEWHvYKrub6LF5dQqQrg@mail.gmail.com"
      type="cite">
      <pre wrap=""> </pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">On Sun, Jan 18, 2015 at 12:59 PM, <span
              dir="ltr">&lt;<a moz-do-not-send="true"
                href="mailto:florin.mateoc@gmail.com" target="_blank">florin.mateoc@gmail.com</a>&gt;</span>
            wrote:<br>
          </div>
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div dir="ltr">
                <div>Ryan,<br>
                </div>
                <div><br>
                </div>
                <div>Can you please explain what you do for
                  initialization (especially for large arrays, sets,
                  etc)? Assuming that Newspeak also has something like
                  Smalltalk's nil, do you fill them at creation time
                  with nil?</div>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>We eagerly assign nil to all slots. For regular
              objects, it is important that slots for a given class are
              always initialized in the same order, otherwise a JS
              engine like V8 won't consider all the instances to be of
              the same Map (hidden class), things will seem more
              polymorphic than they are, and optimizations won't happen.
              For arrays, I don't know whether this is more harmful to
              performance because we pollute type data about the array's
              elements with UndefinedObject or this is more helpful
              because we don't need checks for undefined in #at:.
              Certainly in terms of implementation effort, eager
              initialization is much better than sprinkling checks in
              all the places that access slots.</div>
            <div> </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    There is no need to check for undefined in #at:, or in any place
    that just references slots. Undefined can be assigned and passed
    around in general. The only checks needed are for receivers at
    invocation time (and even those can be sometimes avoided), and then
    (if receiver is undefined) delegate to the UndefinedObject instance<br>
    <br>
    Florin<br>
  </body>
</html>