From:             robert dot sevcik at gmail dot com
Operating system: all
PHP version:      5CVS-2005-07-27 (dev)
PHP Bug Type:     Feature/Change Request
Bug description:  better "overloading"

Description:
------------
Actual state of "overloading", which in PHP5 means "dynamic way to work
with object props and methods" is a bit frustrating.

I'd like to express my point of view if there is a chance to change... it
is a whole philosophy may be for PHP 5.6 or at least PHP6

1) __get() __set() __call() methods should be called whenever they are
present in class, not only if another member of suplied name exists. You
can always decide within the method whether to use existing member or
not.

2) there should be always a default in every class which can be overriden:
providing access to existing members + working with setters and getters
(getVar() xor get_var() style), true method overloading could be
implemented in default as well (multiple method sign. with parameter type
checking must be implemented, type spec for trivial types as well).

3) there should be a way to distinguish between public, protected and
private ( func_get_access_type() ) and to chek which type members are (
class_get_member_access_type() )

4) it should work recursively and set/get together which (not working) i
consider as a bug of current implementation

5) protos should be __get($name, & $value) __set($name, $value)
__call($name, $args, & $returnValue) ; methods should return "Ok,
handled", or "No, not handled" ; engine should try from child to parant
classes to find which class accepted the call ; if none, raise an error.

6) there should be a way to document dynamic properties and methods - i
know this is a litle OT - so it can be used for phpDoc, autocomplete and
so on. (abstract properties syntax?) - yes now I see - that could be
accomplished just by 1)

7) some introspection is needed what coheres with 7) for soap and similar
specialities and for functions like serialize(), isset(), method_exists()
...... no idea how to... __get() __set() __call() could return list of
handled members when called without args, or there could be a new function
__tell() for this?

8) everything should work transparently the same way as static members do
- this sums up 1-7 :)

... :) excuse my english pls :) happy PHPing


-- 
Edit bug report at http://bugs.php.net/?id=33881&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=33881&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=33881&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=33881&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=33881&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=33881&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=33881&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=33881&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=33881&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=33881&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=33881&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=33881&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=33881&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=33881&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=33881&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=33881&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=33881&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=33881&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=33881&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=33881&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=33881&r=mysqlcfg

Reply via email to