Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #16885
| From | Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Order of class definitions within the same file |
| Date | 2016-07-27 20:51 +0200 |
| Organization | albasani.net |
| Message-ID | <nnavqv$gpj$1@news.albasani.net> (permalink) |
| References | <nn21eo$dmq$1@news.albasani.net> <nn8p5j$m6l$1@solani.org> <nnai3s$l47$1@news.albasani.net> <nnam6a$u5b$1@solani.org> |
On 27/07/16 18:06, Christoph M. Becker wrote:
> Anyhow, I found that your second example already works as of PHP 4.3 at
> least, see <https://3v4l.org/2DJJh>. However, the respective manual
> section has only been added in 2010[1], to resolve
> <https://bugs.php.net/bug.php?id=51381>, which also notes that there are
> exceptions from the rule "declare parent before child", which have not
> been addressed. Interestingly, there is another bug report with regard
> to this very issue: <https://bugs.php.net/bug.php?id=70800>.
Interesting. I had not found these bug reports via Google.
> Well, nowadays we may rely on OPcache (or another bytecode cache) to be
> available, which solves the issue. But I agree that combining in a
> single file might still make sense.
Yes, with opcode caches and/or PHAR archives any overhead from including
multiple files is probably reduced to a negligible minimum. Still,
whenever combining several files into a single one is done, a way to
ensure the correct order would be to sort the file names by length --
the idea behind this being that derived classes should have longer names
than their parent class, like
class Thing {}
class FooThing extends Thing {}
class GreenFooThing extends FooThing {}
which would be reflected in the respective file names. Of course, this
requires discipline when naming classes and still feels like a hack.
Greetings,
Thomas
--
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)
Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll 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