[PHP-DEV] Constant Parameters

2007-03-02 Thread Jakob Buchgraber
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

Re: [PHP-DEV] Constant Parameters

2007-03-02 Thread Brian Moon
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

Re: [PHP-DEV] Constant Parameters

2007-03-02 Thread Marco Kaiser
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

Re: [PHP-DEV] Constant Parameters

2007-03-02 Thread Jakob Buchgraber
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

Re: [PHP-DEV] Constant Parameters

2007-03-02 Thread Pierre
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

Re: [PHP-DEV] Constant Parameters

2007-03-02 Thread Guilherme Blanco
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

Re: [PHP-DEV] Constant Parameters

2007-03-02 Thread Sean Coates
$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);

Re: [PHP-DEV] Constant Parameters

2007-03-02 Thread Brian Moon
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

Re: [PHP-DEV] Constant Parameters

2007-03-02 Thread Brian Moon
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