Rasmus Lerdorf wrote:
treated like a normal method in every way. In a few years when people who
have never seen PHP4 happen to create a method with the same name as the
class would get very confused if it didn't work I would think.
Good point.
I'd even extend that to allow __construct being cal
RL>> But we are getting way off the real point which is the question of whether
RL>> you should be allowed to call what I suppose is now the deprecated
RL>> constructor directly or not. I don't see a good reason why it wouldn't be
I don't see any reason to allow two constructors for a class to
CS>> I found the example a bad one too but the more I think about it the more
CS>> I believe that the language shouldn't stop you from designing your
CS>> classes in a way that you call the method which happens also to be a
CS>> constructor later again. And class methods (e.g. Log::log) are anot
On Wed, 24 Mar 2004, Stanislav Malyshev wrote:
> Hm. Do you have some example of such code? Except for object cloning
> issues which are application-wide and constructors won't help you there -
> is there some class code that should be constructed differently in PHP5
> but behave exactly the sam
Stanislav Malyshev wrote:
By "real world" I don't mean "you write up", I mean "someone really needs
it". You are defining language practice now. I think it's a bad practice to
I found the example a bad one too but the more I think about it the more
I believe that the language shouldn't stop you
RL>> There are a number of changes between PHP4 and PHP5 that aren't strictly
RL>> syntactical but rather behavioural so while the code itself will pass the
RL>> php4 syntax check, it would not run as intended and thus be PHP5 only.
Hm. Do you have some example of such code? Except for object cl
On Wed, 24 Mar 2004, Stanislav Malyshev wrote:
> RL>> The example was something like:
> RL>>
> RL>> class foo {
> RL>> function foo() {
> RL>>legacy generic constructor code
> RL>> }
> RL>> function __construct() {
> RL>>php5-specific stuff
> RL>>$this->foo()
RL>> The example was something like:
RL>>
RL>> class foo {
RL>> function foo() {
RL>>legacy generic constructor code
RL>> }
RL>> function __construct() {
RL>>php5-specific stuff
RL>>$this->foo(); // chain to legacy constructor code
RL>> }
RL>> }
RL>>
R
On Wed, 24 Mar 2004, Stanislav Malyshev wrote:
> RL>> > Why the said people won't just insert the PHP5-specific code right into
> RL>> > the constructor? Why they need the second one?
> RL>>
> RL>> To avoid having it in 2 places.
>
> What is the second place? One plase is class() constructor,
RL>> > Why the said people won't just insert the PHP5-specific code right into
RL>> > the constructor? Why they need the second one?
RL>>
RL>> To avoid having it in 2 places.
What is the second place? One plase is class() constructor, and the second
one?
--
Stanislav Malyshev, Zend Products
Hello Andi,
Tuesday, March 23, 2004, 10:24:09 PM, you wrote:
> We had a compile-error which I changed to E_STRICT :)
> I think we should make __construct the default if it is present.
that'd be great.
marcus
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http:/
We had a compile-error which I changed to E_STRICT :)
I think we should make __construct the default if it is present.
Andi
At 08:42 PM 3/23/2004 +0100, Marcus Boerger wrote:
Hello Andi,
Monday, March 22, 2004, 11:24:03 AM, you wrote:
> What would you expect? That if a new style constructor is d
At 09:16 AM 3/23/2004 -0800, Rasmus Lerdorf wrote:
> I agree with the part about the new-style constructor always being
> preferred to the old-style constructor, but besides being really
> confusing, where do you being able to call the old-style as a regular
> method coming in handy?
I could see pe
At 09:16 AM 3/23/2004 -0800, Rasmus Lerdorf wrote:
On Tue, 23 Mar 2004, George Schlossnagle wrote:
> On Mar 23, 2004, at 11:53 AM, Andrei Zmievski wrote:
>
> > On Mon, 22 Mar 2004, Andi Gutmans wrote:
> >> What would you expect? That if a new style constructor is defined we
> >> always
> >> use tha
Hello Andi,
Monday, March 22, 2004, 11:24:03 AM, you wrote:
> What would you expect? That if a new style constructor is defined we always
> use that and allow old-style as regular method?
exactly - and we had that before RC1-final.
marcus
--
PHP Internals - PHP Runtime Development Mailing Lis
On Tue, 23 Mar 2004, Stanislav Malyshev wrote:
> RL>> Sure, but George was asking for a case. I think the case where you have
> RL>> some existing PHP4 code that you want to make minimal changes to but you
> RL>> might have a little bit of PHP5-specific code to run in the constructor I
> RL>>
RL>> Sure, but George was asking for a case. I think the case where you have
RL>> some existing PHP4 code that you want to make minimal changes to but you
RL>> might have a little bit of PHP5-specific code to run in the constructor I
RL>> could see this sort of chaining being something people w
On Mar 23, 2004, at 1:11 PM, Rasmus Lerdorf wrote:
On Tue, 23 Mar 2004, Brad Fisher wrote:
Sure, but George was asking for a case. I think the case where you
have
some existing PHP4 code that you want to make minimal changes to but
you
might have a little bit of PHP5-specific code to run in th
On Tue, 23 Mar 2004, Brad Fisher wrote:
> Rasmus Lerdorf wrote:
>
> > I could see people doing:
> >
> > class foo {
> > function foo() {
> >...constructor stuff...
> > }
> > function __construct() {
> >$this->foo();
> > }
> > }
>
> I actually prefer it the oth
Rasmus Lerdorf wrote:
> I could see people doing:
>
> class foo {
> function foo() {
>...constructor stuff...
> }
> function __construct() {
>$this->foo();
> }
> }
I actually prefer it the other way around... foo would call __construct in
PHP4, and __construct
Rasmus Lerdorf wrote:
I could see people doing:
class foo {
function foo() {
...constructor stuff...
}
function __construct() {
$this->foo();
}
}
Why not just leave out __construct in this case? Or am I missing
something? This looks pretty ugly to me. And if you
On Tue, 23 Mar 2004, George Schlossnagle wrote:
> On Mar 23, 2004, at 11:53 AM, Andrei Zmievski wrote:
>
> > On Mon, 22 Mar 2004, Andi Gutmans wrote:
> >> What would you expect? That if a new style constructor is defined we
> >> always
> >> use that and allow old-style as regular method?
> >
> >
On Tue, 23 Mar 2004, George Schlossnagle wrote:
> I agree with the part about the new-style constructor always being
> preferred to the old-style constructor, but besides being really
> confusing, where do you being able to call the old-style as a regular
> method coming in handy?
I don't reall
On Mar 23, 2004, at 11:53 AM, Andrei Zmievski wrote:
On Mon, 22 Mar 2004, Andi Gutmans wrote:
What would you expect? That if a new style constructor is defined we
always
use that and allow old-style as regular method?
Yep.
I agree with the part about the new-style constructor always being
pref
On Mon, 22 Mar 2004, Andi Gutmans wrote:
> What would you expect? That if a new style constructor is defined we always
> use that and allow old-style as regular method?
Yep.
- Andrei
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
Hello Andi, Sebastian,
Monday, March 22, 2004, 1:01:36 PM, you wrote:
> Andi Gutmans wrote:
>> We already have an E_STRICT for that.
> Good :)
Good, but why not use the new style ctor always?
IIRC the reason for changing the bahavior was problems with inheriting old
style ctor's. Maybe we sho
Andi Gutmans wrote:
> We already have an E_STRICT for that.
Good :)
--
Sebastian Bergmann
http://sebastian-bergmann.de/ http://phpOpenTracker.de/
Das Buch zu PHP 5: http://professionelle-softwareentwicklung-mit-php5.de/
--
PHP Internals - PHP Runtime Development Mailing Li
At 12:12 PM 3/22/2004 +0100, Sebastian Bergmann wrote:
Andi Gutmans wrote:
> Most people will want to use E_STRICT IMO but have lots and lots of
> classes such as PEAR classes which use old-style constructors.
Point taken. But the above does not hold for both styles in the same
class for which
Andi Gutmans wrote:
> Most people will want to use E_STRICT IMO but have lots and lots of
> classes such as PEAR classes which use old-style constructors.
Point taken. But the above does not hold for both styles in the same
class for which I highly recommend the E_STRICT.
--
Sebastian Bergma
At 11:36 AM 3/22/2004 +0100, Sebastian Bergmann wrote:
Andi Gutmans wrote:
> What would you expect? That if a new style constructor is defined we
> always use that and allow old-style as regular method?
- Old-Style Constructor Only: Use it, but issue E_STRICT.
- Old-Style and New-Style Constru
Andi Gutmans wrote:
> What would you expect? That if a new style constructor is defined we
> always use that and allow old-style as regular method?
- Old-Style Constructor Only: Use it, but issue E_STRICT.
- Old-Style and New-Style Constructor: Use the New-Style Constructor and
issue an E
What would you expect? That if a new style constructor is defined we always
use that and allow old-style as regular method?
At 08:56 AM 3/22/2004 +0100, Marcus Boerger wrote:
Hello Andi,
Monday, March 22, 2004, 8:00:42 AM, you wrote:
> We use the last defined constructor. We fixed a problem in
Hello Andi,
Monday, March 22, 2004, 8:00:42 AM, you wrote:
> We use the last defined constructor. We fixed a problem in B4 where old
> style constructors didn't always work.
If so that's a bug. That's absolutley not understandable.
> Andi
> At 12:30 AM 3/22/2004 +, t wrote:
>>>class a
>>{
We use the last defined constructor. We fixed a problem in B4 where old
style constructors didn't always work.
Andi
At 12:30 AM 3/22/2004 +, t wrote:
function a()
{
echo 'a()';
}
}
$a=new a;
?>
Outputs ... a() ... when I would expect ... __construct() ... is this a bug,
some sort of new (on
The below code outputs ... a() ... when I would expect ... __construct() ...
is this a bug,
some sort of new (only seeing this occur since RC1) feature, or some option
I'm supposed to switch off ?
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net
Outputs ... a() ... when I would expect ... __construct() ... is this a bug,
some sort of new (only seeing this occur since RC1) feature, or some option
I'm supposed to switch off ?
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
36 matches
Mail list logo