Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #16987

Re: Order of class definitions within the same file

From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.php
Subject Re: Order of class definitions within the same file
Date 2016-08-29 12:07 +0200
Organization solani.org
Message-ID <nq11hc$910$1@solani.org> (permalink)
References <nn21eo$dmq$1@news.albasani.net> <nn8p5j$m6l$1@solani.org> <nnai3s$l47$1@news.albasani.net> <nnalpt$i0p$1@jstuckle.eternal-september.org> <nnauue$f2k$1@news.albasani.net>

Show all headers | View raw


On 27.07.2016 at 20:35, Thomas Mlynarczyk wrote:

> On 27/07/16 18:00, Jerry Stuckle wrote:
>
>> The problem with any order working is requiring additional passes to
>> parse the code.  For instance, if it were C-B-A, the parser would have
>> to go through three times.  The first would mark C and B as incomplete,
>> and A as complete.  Then it would have to parse C and B again; this time
>> it would mark C as incomplete and B as complete.  Finally, a third pass
>> would mark C as complete.  Of course, this means parsing (and everything
>> else) takes longer.
> 
> I think I get it now. There *are* actually two "passes": the first one
> when the script is compiled and the second one when the script is
> executed. And the latter expects all class definitions to be either
> complete or available via autoloading but it will not bother with
> multiple look-ups.

Indeed.  I just found a more detailed explanantion by one of the PHP
developers:
<http://jpauli.github.io/2015/03/24/zoom-on-php-objects.html#class-binding>.
 (At the end of the section there's even the example that started this
thread.)

-- 
Christoph M. Becker

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Order of class definitions within the same file Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2016-07-24 11:23 +0200
  Re: Order of class definitions within the same file "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-07-27 00:45 +0200
    Re: Order of class definitions within the same file Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-26 23:15 -0400
    Re: Order of class definitions within the same file Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2016-07-27 16:57 +0200
      Re: Order of class definitions within the same file Jerry Stuckle <jstucklex@attglobal.net> - 2016-07-27 12:00 -0400
        Re: Order of class definitions within the same file Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2016-07-27 20:35 +0200
          Re: Order of class definitions within the same file "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-08-29 12:07 +0200
      Re: Order of class definitions within the same file "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-07-27 18:06 +0200
        Re: Order of class definitions within the same file Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2016-07-27 20:51 +0200

csiph-web