Hello!
It would be nice if in PHP 6 using constant parameters for functions and
methods would be possible. This feature is e.g. available in Java.
function doSth (const A) {
if (defined (A)) echo A is a constant;
}
doSth (foo);
Cheers,
Jay
--
PHP Internals - PHP Runtime Development
Jakob Buchgraber wrote:
Hello!
It would be nice if in PHP 6 using constant parameters for functions and
methods would be possible. This feature is e.g. available in Java.
function doSth (const A) {
if (defined (A)) echo A is a constant;
}
doSth (foo);
Cheers,
Jay
Hmm, can you give
Hi Jakob,
It would be nice if in PHP 6 using constant parameters for functions
and methods would be possible. This feature is e.g. available in Java.
function doSth (const A) {
if (defined (A)) echo A is a constant;
}
doSth (foo);
Cheers,
Jay
This makes absolute no sense, why you
Marco Kaiser wrote:
Hi Jakob,
It would be nice if in PHP 6 using constant parameters for functions
and methods would be possible. This feature is e.g. available in Java.
function doSth (const A) {
if (defined (A)) echo A is a constant;
}
doSth (foo);
Cheers,
Jay
This makes absolute no
On 3/2/07, Jakob Buchgraber [EMAIL PROTECTED] wrote:
Marco Kaiser wrote:
Hi Jakob,
It would be nice if in PHP 6 using constant parameters for functions
and methods would be possible. This feature is e.g. available in Java.
function doSth (const A) {
if (defined (A)) echo A is a
Hi,
I think it's a great possibility too, specially when dealing with 3rd
party components.
If you have an interface in your application to be implemented by
others, you can notice them about the constant argument (and should
NOT be redefined) and throw a fatal error (altho I still do not
$db = new DBConnection($properties);
// Notice, still not connected to DB
$third_party_obj-foo($db);
$db-connect();
In the requested feature, the protection is in the wrong hands (that
of the third party object).
You're much better off changing your call to:
$third_party_obj-foo(clone $db);
Guilherme Blanco wrote:
Why? Because $db should be a constant and could not be modified.
Allowing this, the 3rd party component could redefine some important
properties inside of your object and may cause unbelievable issues in
your appplication.
This makes it sound like you let other people
Brian Moon wrote:
You can call time pass as const.
Damn, need to proof read. Should be CAN'T
--
Brian Moon
-
http://dealnews.com/
It's good to be cheap =)
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php