<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 09/23/2014 08:47 PM, Boian Mitov
      wrote:<br>
    </div>
    <blockquote cite="mid:AF0D5554B62E4F0E9B6440C41433FA97@mpc1"
      type="cite">
      <div dir="ltr">
        <div style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial'; COLOR:
          #000000">
          <div>This is a valid point.</div>
          <div>The only downside is that the object will every time do a
            deep copy versus a shallow (pointer only) copy. Deep copy is
            very, very expensive operation.</div>
          <div>Adding ref. counting to objects is probably equivalent of
            one interlocked assembly instruction, so a very small
            difference, probably not even measurable.</div>
          <div>Copy of a large object can take a large memory transfer,
            and will also reserve memory for each copy, thus
            significantly increasing memory.</div>
          <div>While both approaches have something going for them, they
            are not total subside for each other.</div>
        </div>
      </div>
    </blockquote>
    Yes, but if you have compiler support for objects with automatic
    calls of constructors/destructor/copy constructor/assignment
    operator (like in C++ classes), and if you also have generics
    support for objects, you can make a generic smart pointer object
    type that adds reference counting to any class. And then the regular
    class references will serve as weak references. Exactly like C++:<br>
    <br>
    <a class="moz-txt-link-freetext" href="http://www.boost.org/doc/libs/1_56_0/libs/smart_ptr/smart_ptr.htm">http://www.boost.org/doc/libs/1_56_0/libs/smart_ptr/smart_ptr.htm</a><br>
    <br>
    What's more important is that we can extend objects this way,
    without breaking backward compatibility. But, unfortunately, it's a
    huge slippery slope from there, as anyone, who has dealt with C++
    STL error messages knows:<br>
    <br>
<a class="moz-txt-link-freetext" href="http://pascalg.wordpress.com/2008/02/24/stl-error-messages-are-so-great/">http://pascalg.wordpress.com/2008/02/24/stl-error-messages-are-so-great/</a><br>
    <br>
    Nikolay<br>
    <blockquote cite="mid:AF0D5554B62E4F0E9B6440C41433FA97@mpc1"
      type="cite">
      <div dir="ltr">
        <div style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial'; COLOR:
          #000000">
          <div> </div>
          <div style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial'; COLOR:
            #000000">With best regards,<br>
            Boian Mitov<br>
            <br>
            -------------------------------------------------------<br>
            Mitov Software<br>
            <a class="moz-txt-link-abbreviated" href="http://www.mitov.com">www.mitov.com</a><br>
            -------------------------------------------------------</div>
          <div style="FONT-SIZE: small; TEXT-DECORATION: none;
            FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal;
            COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline">
            <div style="FONT: 10pt tahoma">
              <div> </div>
              <div style="BACKGROUND: #f5f5f5">
                <div style="font-color: black"><b>From:</b> <a
                    moz-do-not-send="true"
                    title="augustoktobar@gmail.com"
                    href="mailto:augustoktobar@gmail.com">August Oktobar</a>
                </div>
                <div><b>Sent:</b> Tuesday, September 23, 2014 10:35 AM</div>
                <div><b>To:</b> <a moz-do-not-send="true"
                    title="fpc-devel@lists.freepascal.org"
                    href="mailto:fpc-devel@lists.freepascal.org">FPC
                    developers' list</a> </div>
                <div><b>Subject:</b> Re: [fpc-devel] Suggestion:
                  reference counted objects</div>
              </div>
            </div>
            <div> </div>
          </div>
          <div style="FONT-SIZE: small; TEXT-DECORATION: none;
            FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal;
            COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline">
            <div dir="ltr">To somebody (probably Sven):<br>
              <br>
              In FPC there is concept of stack based objects (object) <span
                id="result_box" lang="en"><span></span><span>that behave
                  like</span> <span>classes</span> <span>(</span><span>with</span>
                <span>inheritance</span><span>)</span><span></span></span>?<span
                id="result_box" lang="en"><br>
                <span>Why not</span> just extend this object with
                support for <span>constructors and</span> <span>destructors</span><span>,
                  and</span> <span>there is no need</span> <span>for</span>
                <span>the ARC</span><span>?</span></span><br>
            </div>
            <div class="gmail_extra">
              <div> </div>
              <div class="gmail_quote">On Mon, Sep 22, 2014 at 2:05 PM,
                Hans-Peter Diettrich <span dir="ltr"><<a
                    moz-do-not-send="true"
                    href="mailto:DrDiettrich1@aol.com" target="_blank">DrDiettrich1@aol.com</a>></span>
                wrote:<br>
                <blockquote class="gmail_quote" style="PADDING-LEFT:
                  1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px
                  solid">Sven Barth schrieb:<br>
                  <blockquote class="gmail_quote" style="PADDING-LEFT:
                    1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc
                    1px solid">Am 22.09.2014 09:47 schrieb "Michael
                    Schnell" <<a moz-do-not-send="true"
                      href="mailto:mschnell@lumino.de" target="_blank">mschnell@lumino.de</a>
                    <br>
                  </blockquote>
                  <br>
                  <blockquote class="gmail_quote" style="PADDING-LEFT:
                    1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc
                    1px solid">> Why not use "interface" to add
                    ref-counting to an object ? This seems to work
                    nicely even though the name "interface" in not
                    "speaking" on that behalf.<br>
                    <br>
                    Because you'll need to declare an interface for each
                    class you want to have reference counted so that you
                    can access its methods, properties, etc.<br>
                  </blockquote>
                  <br>
                  This overhead could be eliminated by another syntax
                  extension, like<br>
                    TMyARCclass = interface(TObject)<br>
                  where the Compiler could allow for implementations of
                  the declared methods just as for<br>
                    TMyARCclass = class(TObject)<br>
                  bridging the gap between traditional (strictly
                  declarative) interfaces and classes (including
                  implementations), with or without ARC.<br>
                  <br>
                  DoDi<br>
                  <br>
                  _______________________________________________<br>
                  fpc-devel maillist  -  <a moz-do-not-send="true"
                    href="mailto:fpc-devel@lists.freepascal.org"
                    target="_blank">fpc-devel@lists.freepascal.org</a><br>
                  <a moz-do-not-send="true"
                    href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel"
                    target="_blank">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a><br>
                </blockquote>
              </div>
              <div> </div>
            </div>
            <p>
            </p>
            <hr>
            _______________________________________________<br>
            fpc-devel maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a><br>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a><br>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
fpc-devel maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>