<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Am 31.10.2013 15:41, schrieb Frederic
      Da Vitoria:<br>
    </div>
    <blockquote
cite="mid:CANe_y9S8d+H6TY_UXA7wy-J+cFvVhiQTYhG-iFONRbfc0vsTAg@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">2013/10/31 Sven Barth <span
              dir="ltr"><<a moz-do-not-send="true"
                href="mailto:pascaldragon@googlemail.com"
                target="_blank">pascaldragon@googlemail.com</a>></span><br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div text="#000000" bgcolor="#FFFFFF">
                <div>Am 31.10.2013 14:42, schrieb Frederic Da Vitoria:<br>
                </div>
                <div class="im">
                  <blockquote type="cite">
                    <div dir="ltr">
                      <div class="gmail_extra">
                        <div class="gmail_quote">2013/10/31 Sven Barth <span
                            dir="ltr"><<a moz-do-not-send="true"
                              href="mailto:pascaldragon@googlemail.com"
                              target="_blank">pascaldragon@googlemail.com</a>></span><br>
                          <blockquote class="gmail_quote"
                            style="margin:0 0 0 .8ex;border-left:1px
                            #ccc solid;padding-left:1ex">
                            <div text="#000000" bgcolor="#FFFFFF">
                              <div>Am 31.10.2013 12:38, schrieb Frederic
                                Da Vitoria:<br>
                              </div>
                              <div>
                                <div>
                                  <blockquote type="cite">
                                    <div dir="ltr">
                                      <div class="gmail_extra">
                                        <div class="gmail_quote">2013/10/31
                                          Sven Barth <span dir="ltr"><<a
                                              moz-do-not-send="true"
                                              href="mailto:pascaldragon@googlemail.com"
                                              target="_blank">pascaldragon@googlemail.com</a>></span><br>
                                          <blockquote
                                            class="gmail_quote"
                                            style="margin:0 0 0
                                            .8ex;border-left:1px #ccc
                                            solid;padding-left:1ex">
                                            <div text="#000000"
                                              bgcolor="#FFFFFF">
                                              <div>Am 31.10.2013 02:45,
                                                schrieb Xiangrong Fang:<br>
                                              </div>
                                              <div>
                                                <div>
                                                  <blockquote
                                                    type="cite">
                                                    <div dir="ltr">
                                                      <div
                                                        style="font-family:courier
                                                        new,monospace"><span
style="font-family:arial">2013/10/30 Jonas Maebe </span><span dir="ltr"
style="font-family:arial"><<a moz-do-not-send="true"
                                                          href="mailto:jonas.maebe@elis.ugent.be"
target="_blank">jonas.maebe@elis.ugent.be</a>></span><br>
                                                      </div>
                                                      <div
                                                        class="gmail_extra">
                                                        <div
                                                          class="gmail_quote">
                                                          <blockquote
                                                          class="gmail_quote"
                                                          style="margin:0
                                                          0 0
                                                          .8ex;border-left:1px
                                                          #ccc
                                                          solid;padding-left:1ex">
                                                          <div><br>
                                                          </div>
                                                          This is not
                                                          equivalent. A
                                                          private type
                                                          declaration in
                                                          a class adds a
                                                          new identifier
                                                          that is
                                                          visible inside
                                                          that class.
                                                          You then use
                                                          it, still in
                                                          that class, to
                                                          declare the
                                                          return type of
                                                          a function.
                                                          Next, in a
                                                          scope where
                                                          that type
                                                          identifier is
                                                          no longer
                                                          visible, you
                                                          call the
                                                          function.<br>
                                                          <br>
                                                          My example is
                                                          a complete
                                                          match to that
                                                          scenario as
                                                          far as
                                                          identifier
                                                          visibility is
                                                          concerned (you
                                                          use a type in
                                                          a scope where
                                                          it is visible
                                                          to declare a
                                                          function
                                                          return type,
                                                          and then call
                                                          the function
                                                          in a scope
                                                          where it is
                                                          not visible).
                                                          In your
                                                          example, the
                                                          type is not
                                                          visible in the
                                                          place where
                                                          the function
                                                          is declared
                                                          but only where
                                                          it is defined
                                                          <div> .</div>
                                                          </blockquote>
                                                          <div><br>
                                                          </div>
                                                          <div>
                                                          <div>This is
                                                          logically
                                                          WRONG. Because
                                                          to the
                                                          machine, any
                                                          function
                                                          return value
                                                          can be seen as
                                                          an array of
                                                          bytes, for
                                                          example, a
                                                          pointer is
                                                          array[0..3] of
                                                          Byte on a
                                                          32-bit
                                                          machine.  The
                                                          purpose of
                                                          type system is
                                                          to explain
                                                          what these
                                                          bytes stands
                                                          for. So, if a
                                                          type is
                                                          out-of-scope,
                                                          how do you
                                                          interpret the
                                                          data?  </div>
                                                          <div><br>
                                                          </div>
                                                          <div>The
                                                          current
                                                          "delphi
                                                          compatible"
                                                          implementation
                                                          IS using the
                                                          type
                                                          information to
                                                          compile the
                                                          program, i.e.
                                                          although it is
                                                          not visible,
                                                          it is indeed
                                                          used by the
                                                          compile,
                                                          which, in my
                                                          opinion,
                                                          violates
                                                          visibility
                                                          rules.</div>
                                                          <div><br>
                                                          </div>
                                                          <div>Standing
                                                          on your view
                                                          point, if a
                                                          type is no
                                                          longer
                                                          visible, but a
                                                          variable
                                                          (function
                                                          return value)
                                                          of that type
                                                          is in current
                                                          scope, and
                                                          understood by
                                                          the program,
                                                          this means,
                                                          this value
                                                          itself carries
                                                          type
                                                          information!
                                                           Is is kind of
                                                          meta data
                                                          available in
                                                          Pascal? If so,
                                                          I think RTTI
                                                          should work
                                                          for ANY kind
                                                          of primitive
                                                          data types.</div>
                                                          <br>
                                                          </div>
                                                        </div>
                                                      </div>
                                                    </div>
                                                  </blockquote>
                                                </div>
                                              </div>
                                              For unit interfaces there
                                              is indeed the point that
                                              if unit A uses unit B then
                                              the program which uses
                                              unit A will be able to
                                              access types used by unit
                                              A. E.g.:</div>
                                          </blockquote>
                                        </div>
                                      </div>
                                    </div>
                                  </blockquote>
                                </div>
                              </div>
                            </div>
                          </blockquote>
                        </div>
                      </div>
                    </div>
                  </blockquote>
                </div>
                ...
                <div class="im"><br>
                  <blockquote type="cite">
                    <div dir="ltr">
                      <div class="gmail_extra">
                        <div class="gmail_quote">
                          <blockquote class="gmail_quote"
                            style="margin:0 0 0 .8ex;border-left:1px
                            #ccc solid;padding-left:1ex">
                            <div text="#000000" bgcolor="#FFFFFF">
                              <div>
                                <div>
                                  <blockquote type="cite">
                                    <div dir="ltr">
                                      <div class="gmail_extra">
                                        <div class="gmail_quote">
                                          <blockquote
                                            class="gmail_quote"
                                            style="margin:0 0 0
                                            .8ex;border-left:1px #ccc
                                            solid;padding-left:1ex">
                                            <div text="#000000"
                                              bgcolor="#FFFFFF">It's
                                              this way at least since
                                              Turbo Pascal (though
                                              without classes then ;) ).<br>
                                            </div>
                                          </blockquote>
                                        </div>
                                        <br>
                                      </div>
                                      <div class="gmail_extra">Yes, I
                                        agree this is the TP/Delphi way,
                                        and as such should be kept at
                                        least in DELPHI mode. But is
                                        this really good? Doesn't this
                                        contradict the Pascal
                                        philosophy? Borland did a few
                                        questionable things (look at how
                                        you used the semicolons in you
                                        examples above ;-) ), and it
                                        took some decisions when
                                        implementing units. But how is
                                        this handled in Modula?<br
                                          clear="all">
                                      </div>
                                    </div>
                                  </blockquote>
                                </div>
                              </div>
                              Undoing this even for only non-TP/Delphi
                              modes would mean adjusting very much code
                              out there. So no, this is how Object
                              Pascal works.<br>
                            </div>
                          </blockquote>
                        </div>
                        <br>
                      </div>
                      <div class="gmail_extra">Ah, you mean that this is
                        too much intricately mixed with the compiler
                        code and it would be much too much work to
                        change? OK, this I understand :-)<br clear="all">
                      </div>
                      <div class="gmail_extra"><br>
                      </div>
                    </div>
                  </blockquote>
                </div>
                It's not about being mixed with the compiler code it's
                about too many legacy code relying on this behavior,
                because it's a given since TP times.<br>
              </div>
            </blockquote>
          </div>
          <br>
        </div>
        <div class="gmail_extra">...and this modification would only
          become relevant for new code, so quite probably not worth the
          compiler extra code. Yes, I can understand this too. But my
          question was not about changing the behavior of fpc (not any
          more). This was a theoretical question. In other words, if you
          had been in a position to create TP back in nineteen
          something, and if one of your main concerns had been about
          respecting the Pascal philosophy, how would you have handled
          this? The way it has been done? Or do you agree this was not
          quite orthodox (although efficient)? <br clear="all">
        </div>
      </div>
    </blockquote>
    I honestly don't know what I would have done...<br>
    <br>
    Regards,<br>
    Sven<br>
  </body>
</html>