Home > Archive > PHP Zend Engine > October 2006 > RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_2) / zend_compile.c
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_2) / zend_compile.c
|
|
| Dmitry Stogov 2006-10-20, 3:56 am |
| Why?
Dmitry.
> -----Original Message-----
> From: Ilia Alshanetsky [mailto:iliaa@php.net]=20
> Sent: Friday, October 20, 2006 6:44 AM
> To: zend-engine-cvs@lists.php.net
> Subject: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_2) / zend_compile.c=20
>=20
>=20
> iliaa Fri Oct 20 02:44:02 2006 UTC
>=20
> Modified files: (Branch: PHP_5_2)
> /ZendEngine2 zend_compile.c=20
> Log:
> Make use of abstract methods be E_STRICT rather then E_ERROR
> =20
> =20
> http://cvs.php.net/viewvc.cgi/ZendE...mpile.c?r1=3D1.
647.2.27.2.19&r2=3D1.647.2.27.2.20&diff_format=3Du
Index: ZendEngine2/zend_compile.c
diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.19
ZendEngine2/zend_compile.c:1.647.2.27.2.20
--- ZendEngine2/zend_compile.c:1.647.2.27.2.19 Tue Oct 3 11:10:33 2006
+++ ZendEngine2/zend_compile.c Fri Oct 20 02:44:02 2006
@@ -17,7 +17,7 @@
=
+----------------------------------------------------------------------+
*/
=20
-/* $Id: zend_compile.c,v 1.647.2.27.2.19 2006/10/03 11:10:33 dmitry Exp =
$
*/
+/* $Id: zend_compile.c,v 1.647.2.27.2.20 2006/10/20 02:44:02 iliaa Exp=20
+$ */
=20
#include <zend_language_parser.h>
#include "zend.h"
@@ -1080,7 +1080,7 @@
fn_flags =3D 0;
}
if ((fn_flags & ZEND_ACC_STATIC) && (fn_flags & ZEND_ACC_ABSTRACT)
&& !(CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) {
- zend_error(E_COMPILE_ERROR, "Static function %s%s%s() cannot
be abstract", is_method ? CG(active_class_entry)->name : "", is_method ?
"::" : "", Z_STRVAL(function_name->u.constant));
+ zend_error(E_STRICT, "Static function %s%s%s() should not be
+abstract", is_method ? CG(active_class_entry)->name : "", is_method ? =
"::"
: "", Z_STRVAL(function_name->u.constant));
}
=20
function_token->u.op_array =3D CG(active_op_array);
--=20
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
| |
| Andi Gutmans 2006-10-20, 3:56 am |
| I cant remember the discussion we had in the past.
Why is it important to not allow overriding of static functions? We
can/should probably enforce the same contract of course.
> -----Original Message-----
> From: Dmitry Stogov [mailto:dmitry@zend.com]
> Sent: Friday, October 20, 2006 12:40 AM
> To: 'Ilia Alshanetsky'; Andi Gutmans
> Cc: zend-engine-cvs@lists.php.net
> Subject: RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_2) /
> zend_compile.c
>
> Why?
>
> Dmitry.
>
> zend_compile.c
> 647.2.27.2.19&r2=1.647.2.27.2.20&diff_format=u
> Index: ZendEngine2/zend_compile.c
> diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.19
> ZendEngine2/zend_compile.c:1.647.2.27.2.20
> --- ZendEngine2/zend_compile.c:1.647.2.27.2.19 Tue Oct
> 3 11:10:33 2006
> +++ ZendEngine2/zend_compile.c Fri Oct 20 02:44:02 2006
> @@ -17,7 +17,7 @@
>
> +-------------------------------------------------------------
> ---------+
> */
>
> -/* $Id: zend_compile.c,v 1.647.2.27.2.19 2006/10/03 11:10:33
> dmitry Exp $ */
> +/* $Id: zend_compile.c,v 1.647.2.27.2.20 2006/10/20 02:44:02
> iliaa Exp
> +$ */
>
> #include <zend_language_parser.h>
> #include "zend.h"
> @@ -1080,7 +1080,7 @@
> fn_flags = 0;
> }
> if ((fn_flags & ZEND_ACC_STATIC) && (fn_flags &
> ZEND_ACC_ABSTRACT) && !(CG(active_class_entry)->ce_flags &
> ZEND_ACC_INTERFACE)) {
> - zend_error(E_COMPILE_ERROR, "Static function
> %s%s%s() cannot
> be abstract", is_method ? CG(active_class_entry)->name : "",
> is_method ?
> "::" : "", Z_STRVAL(function_name->u.constant));
> + zend_error(E_STRICT, "Static function %s%s%s()
> should not be
>
> +abstract", is_method ? CG(active_class_entry)->name : "",
> is_method ? "::"
> : "", Z_STRVAL(function_name->u.constant));
> }
>
> function_token->u.op_array = CG(active_op_array);
>
> --
> Zend Engine CVS Mailing List (http://cvs.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
>
>
>
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
| |
|
|
| Andi Gutmans 2006-10-20, 3:56 am |
| Seems like I missed that whole thread.
I don't quite understand what we have to gain from dissallowing overriding
static methods and/or abstract static methods. It's not really in the PHP
spirit.
Making it E_STRICT doesn't solve the situation because it will tell people
it's not an ok thing to do, and I'm not quite sure that's what we want.
Can we revert to 5.1 status quo and get 5.2 shipped and discuss this?
Shipping it like this and then reverting later will just create a huge
headache and will confuse our user-base.
Btw, I don't quite understand why it doesn't make sense? Maybe people are
not used to it from other OO langauges but the "no sense" argument isn't
very convincing. I actually see it as a way to enforce a contract or
structure. Some might not agree with it but I don't see how it violates any
rules of the universe...
Andi
> -----Original Message-----
> From: Derick Rethans [mailto:derick@php.net]
> Sent: Friday, October 20, 2006 1:11 AM
> To: Andi Gutmans
> Cc: 'Dmitry Stogov'; 'Ilia Alshanetsky'; zend-engine-cvs@lists.php.net
> Subject: RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_2) /
> zend_compile.c
>
> On Fri, 20 Oct 2006, Andi Gutmans wrote:
>
>
> http://marc.theaimsgroup.com/?t=116129338300001&r=1&w=2
> and
> http://marc.theaimsgroup.com/?t=114734986200004&r=1&w=2
>
> regards,
> Derick
>
> --
> Zend Engine CVS Mailing List (http://cvs.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
>
>
>
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
| |
| Dmitry Stogov 2006-10-20, 3:56 am |
| Static methods may not de overridden.
It is absolutely legal if static method in children classes have
incompatible prototypes with static method in parent class.
For what reason we need "abstract static methods"?
Are we OOP pioneers?
Dmitry.
> -----Original Message-----
> From: Derick Rethans [mailto:derick@php.net]
> Sent: Friday, October 20, 2006 12:11 PM
> To: Andi Gutmans
> Cc: 'Dmitry Stogov'; 'Ilia Alshanetsky'; zend-engine-cvs@lists.php.net
> Subject: RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_2) /
> zend_compile.c
>
>
> On Fri, 20 Oct 2006, Andi Gutmans wrote:
>
>
> http://marc.theaimsgroup.com/?t=116129338300001&r=1&w=2
> and
> http://marc.theaimsgroup.com/?t=114734986200004&r=1&w=2
>
> regards,
> Derick
>
| |
| Andi Gutmans 2006-10-20, 3:56 am |
| Can you give an example re: what you mean? Marcus and you are making
statements as if it's the most obvious thing in the world but I guess I just
don't see why it's so obvious (besides other languages doing it).
When would you have two incompatible protoypes in static methods in two
children? (talking about a common known case)
Anyway, for now E_STRICT is definitely better than E_ERROR so that we don't
kill our users. Maybe post 5.2 we can do E_STRICT and E_DEPRECATED but I'm
still curious to be enlightened here. I guess I'm not theoretical enough :)
Andi
> -----Original Message-----
> From: Dmitry Stogov [mailto:dmitry@zend.com]
> Sent: Friday, October 20, 2006 1:44 AM
> To: 'Derick Rethans'; 'Andi Gutmans'
> Cc: 'Ilia Alshanetsky'; zend-engine-cvs@lists.php.net
> Subject: RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_2) /
> zend_compile.c
>
> Static methods may not de overridden.
> It is absolutely legal if static method in children classes
> have incompatible prototypes with static method in parent class.
> For what reason we need "abstract static methods"?
>
> Are we OOP pioneers?
>
> Dmitry.
>
> zend-engine-cvs@lists.php.net
> functions? We
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
>
>
>
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
| |
| Dmitry Stogov 2006-10-20, 7:56 am |
|
> -----Original Message-----
> From: Andi Gutmans [mailto:andi@zend.com]
> Sent: Friday, October 20, 2006 12:58 PM
> To: 'Dmitry Stogov'; 'Derick Rethans'
> Cc: 'Ilia Alshanetsky'; zend-engine-cvs@lists.php.net
> Subject: RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2(PHP_5_2) /
> zend_compile.c
>
>
> Can you give an example re: what you mean? Marcus and you are
> making statements as if it's the most obvious thing in the
> world but I guess I just don't see why it's so obvious
> (besides other languages doing it)
I don't know such kind of languages.
Usually only virtual methods must mach to parent's prototype.
> When would you have two
> incompatible protoypes in static methods in two children?
> (talking about a common known case)
abstract class Shape {
}
class Rectangle extends Shape {
static function Create($width, $height) {...}
}
class Circle extends Shape {
static function Create($radius) {...}
}
Dmitry.
> Anyway, for now E_STRICT is definitely better than E_ERROR so
> that we don't kill our users. Maybe post 5.2 we can do
> E_STRICT and E_DEPRECATED but I'm still curious to be
> enlightened here. I guess I'm not theoretical enough :) Andi
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
>
>
>
|
|
|
|
|