Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Robert Cummings
On Tue, 2008-04-29 at 23:37 -0700, Stanislav Malyshev wrote: > > $hair = new Hair(); > > $hair->colour = 'brown'; > > You can do this without pre-defining any properties. yes but the following (as I'm you certainly know): echo $hair->colour generates an E_NOTICE if the property isn't defin

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Stanislav Malyshev
$hair = new Hair(); $hair->colour = 'brown'; You can do this without pre-defining any properties. The above is a much less wordy way of doing the following: No, it is not the same. You can override what happens when you do setColor - like send notification to some other object or set also

Re: [PHP-DEV] PHP 5.2.6RC5 windows build available

2008-04-29 Thread Pierre Joye
On Tue, Apr 29, 2008 at 11:58 PM, Rob Richards <[EMAIL PROTECTED]> wrote: > A little late to the party, but the windows build for PHP 5.2.6RC5 is > finally available. Please test it as much as possible. > > http://pecl2.php.net/downloads/php-windows-builds/qa/php-5.2.6RC5-Win32.zip It is especial

Re: [PHP-DEV] Return type hinting patch

2008-04-29 Thread Arvids Godjuks
I'm +1 for this syntax function int myfunction(int $param) { return $someint; } C/C++ like, easy to understand And bad idea about making a return type "function" - looks very useless and will not be used a lot. Work with objects with methods returning an object of some kind, then you can d

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Robert Cummings
On Wed, 2008-04-30 at 01:22 -0400, Nathan Nobbe wrote: > On Wed, Apr 30, 2008 at 1:07 AM, Robert Cummings <[EMAIL PROTECTED]> wrote: > We are not talking about data here. We are talking about > properties. > Data is assigned to a property which is akin to functionality >

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Robert Cummings
On Tue, 2008-04-29 at 22:21 -0700, Stanislav Malyshev wrote: > > But then you need to check if it exists lest you raise an E_NOTICE > > because it doesn't exist. Additionally, E_NOTICE is run-time, interface > > checking is compile-time. > > I don't understand what you mean here. PHP can't check

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Nathan Nobbe
On Wed, Apr 30, 2008 at 1:07 AM, Robert Cummings <[EMAIL PROTECTED]> wrote: > > On Wed, 2008-04-30 at 00:27 -0400, Nathan Nobbe wrote: > > On Wed, Apr 30, 2008 at 12:05 AM, Robert Cummings > > > > Abstract classes and interfaces are not the same. They are > > used for > > f

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Stanislav Malyshev
But then you need to check if it exists lest you raise an E_NOTICE because it doesn't exist. Additionally, E_NOTICE is run-time, interface checking is compile-time. I don't understand what you mean here. PHP can't check variable accesses compile-time. In fact, in PHP "compile-time" doesn't mean

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Robert Cummings
On Tue, 2008-04-29 at 22:12 -0700, Stanislav Malyshev wrote: > > an interface with an interface property of x, then all implementations > > using that interface would know that property x exists and could use it > > You can use property in PHP without declaring it previously. But then you need t

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Stanislav Malyshev
an interface with an interface property of x, then all implementations using that interface would know that property x exists and could use it You can use property in PHP without declaring it previously. -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/ (408

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Robert Cummings
On Wed, 2008-04-30 at 00:27 -0400, Nathan Nobbe wrote: > On Wed, Apr 30, 2008 at 12:05 AM, Robert Cummings > > Abstract classes and interfaces are not the same. They are > used for > fundamentally different reasons. An interface is to enforce a > contract

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Nathan Nobbe
On Wed, Apr 30, 2008 at 12:05 AM, Robert Cummings <[EMAIL PROTECTED]> wrote: > On Tue, 2008-04-29 at 23:51 -0400, Nathan Nobbe wrote: > > On Tue, Apr 29, 2008 at 9:22 PM, Robert Cummings <[EMAIL PROTECTED]> > > wrote: > > > > > > > > That should be a matter of choice for the developer. When you sa

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Robert Cummings
On Tue, 2008-04-29 at 23:51 -0400, Nathan Nobbe wrote: > On Tue, Apr 29, 2008 at 9:22 PM, Robert Cummings <[EMAIL PROTECTED]> > wrote: > > > > > That should be a matter of choice for the developer. When you say > "but > > when, down the road, some logic...", all I see is you waving your > hands >

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Nathan Nobbe
On Tue, Apr 29, 2008 at 9:22 PM, Robert Cummings <[EMAIL PROTECTED]> wrote: > > On Tue, 2008-04-29 at 19:01 -0600, Nathan Nobbe wrote: > > On Tue, Apr 29, 2008 at 6:14 PM, Richard Quadling < > [EMAIL PROTECTED]> > > wrote: > > > > > 2008/4/30 Robert Cummings <[EMAIL PROTECTED]>: > > > > > > > > O

Re: [PHP-DEV] Return type hinting patch

2008-04-29 Thread Jessie Hernandez
Sam Barrow wrote: Well in summation I think this is something that should be implemented, I don't see any arguments against implementing this atleast for arrays and classes, like we already have for function parameters. The only thing left would be to decide on the syntax public array function

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Robert Cummings
On Tue, 2008-04-29 at 19:01 -0600, Nathan Nobbe wrote: > On Tue, Apr 29, 2008 at 6:14 PM, Richard Quadling <[EMAIL PROTECTED]> > wrote: > > > 2008/4/30 Robert Cummings <[EMAIL PROTECTED]>: > > > > > > On Tue, 2008-04-29 at 20:04 +0200, John Carter -X (johncart - PolicyApp > > > > > > Ltd at Cisc

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Nathan Nobbe
On Tue, Apr 29, 2008 at 6:14 PM, Richard Quadling <[EMAIL PROTECTED]> wrote: > 2008/4/30 Robert Cummings <[EMAIL PROTECTED]>: > > > > On Tue, 2008-04-29 at 20:04 +0200, John Carter -X (johncart - PolicyApp > > > > Ltd at Cisco) wrote: > > > I think there's been two responses to this query: > >

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Richard Quadling
2008/4/30 Robert Cummings <[EMAIL PROTECTED]>: > > On Tue, 2008-04-29 at 20:04 +0200, John Carter -X (johncart - PolicyApp > > Ltd at Cisco) wrote: > > I think there's been two responses to this query: > > > > 1. We can't have properties in interfaces because interfaces don't have > > properti

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Jeremy Privett
Robert Cummings wrote: On Tue, 2008-04-29 at 20:04 +0200, John Carter -X (johncart - PolicyApp Ltd at Cisco) wrote: I think there's been two responses to this query: 1. We can't have properties in interfaces because interfaces don't have properties. I would say this is tautological and doesn

RE: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Robert Cummings
On Tue, 2008-04-29 at 20:04 +0200, John Carter -X (johncart - PolicyApp Ltd at Cisco) wrote: > I think there's been two responses to this query: > > 1. We can't have properties in interfaces because interfaces don't have > properties. I would say this is tautological and doesn't add anything. >

[PHP-DEV] OS X, enable embed problem, patch

2008-04-29 Thread Christopher Thompson
Please be gentle, I have very little experience developing on OS X. To be honest, the whole dylib thing seems messy and confusing to me, compared to the fairly straight-forward Linux style .so approach. Expected behavior: Able to configure and build on OS X with: ./configure --enable-embed A

[PHP-DEV] PHP 5.2.6RC5 windows build available

2008-04-29 Thread Rob Richards
A little late to the party, but the windows build for PHP 5.2.6RC5 is finally available. Please test it as much as possible. http://pecl2.php.net/downloads/php-windows-builds/qa/php-5.2.6RC5-Win32.zip http://pecl2.php.net/downloads/php-windows-builds/qa/php-debug-pack-5.2.6RC5-Win32.zip The non

RE: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread John Carter -X (johncart - PolicyApp Ltd at Cisco)
I think there's been two responses to this query: 1. We can't have properties in interfaces because interfaces don't have properties. I would say this is tautological and doesn't add anything. 2. Why would you need to? Getters and setters work. So I suppose to answer my question for myself, ther

Re: Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Nathan Nobbe
On Tue, Apr 29, 2008 at 10:28 AM, John Carter -X (johncart - PolicyApp Ltd at Cisco) <[EMAIL PROTECTED]> wrote: > Nathan, > > By example: > > interface EggLayer > > { >public $eggsLaid; > } > > class Chicken implements EggLayer; > > Some would say (and maybe I would too) that you should have a

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Stanislav Malyshev
Hi! But, when you add the possibility of getters and setters, a property becomes an abstraction. It would make sense that an interface declares Nothing prevents you from having getters and setters as part of the interface :) Properties in interfaces make no sense now, but if we ever get a

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Stanislav Malyshev
Hi! I understand why Interfaces can't have bodies, but could you explain why Interfaces can't have properties? Interfaces are API descriptions. API is usually seen as composed of functions. Some go even as far as recommending even classes don't have public properties at all :) In any case

RE: Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread John Carter -X (johncart - PolicyApp Ltd at Cisco)
Nathan, By example: interface EggLayer { public $eggsLaid; } class Chicken implements EggLayer; Some would say (and maybe I would too) that you should have a getEggsLaid() method, that's fair enough. But why not the above? You say interfaces can't have properties because they requir

Re: Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Nathan Nobbe
On Tue, Apr 29, 2008 at 9:51 AM, John Carter -X (johncart - PolicyApp Ltd at Cisco) <[EMAIL PROTECTED]> wrote: > The article explicitly mentions OOP interfaces in a few languages. my bad. > But > the article, or for that matter any formal definition of an interface > isn't really what I asked

Re: [PHP-DEV] Inheritance/compatibility behavior

2008-04-29 Thread Stanislav Malyshev
Hi! Sam Barrow wrote: I want to make two classes: abstract class a { abstract public function go($a); } final class b extends a { abstract public function go(array $a); } LSP violation here: a accepts go("away") but b doesn't. This will not work, I get an error that the two

Re: [PHP-DEV] Return type hinting patch

2008-04-29 Thread Sam Barrow
On Tue, 2008-04-29 at 18:00 +0200, David Zülke wrote: > As I've pointed out, > > public array x() > > will become ambiguous once we introduce a type "function", which is > not unlikely at this point That's what I thought, that's why I said number 1 is the most likely. > > David > > > > >

Re: [PHP-DEV] Return type hinting patch

2008-04-29 Thread Stanislav Malyshev
Hi! Well in summation I think this is something that should be implemented, I don't see any arguments against implementing this atleast for arrays and classes, like we already have for function parameters. I think we had plenty of arguments against it last time it was discussed. You could se

Re: [PHP-DEV] Return type hinting patch

2008-04-29 Thread David Zülke
As I've pointed out, public array x() will become ambiguous once we introduce a type "function", which is not unlikely at this point David Am 29.04.2008 um 17:22 schrieb Sam Barrow: Well in summation I think this is something that should be implemented, I don't see any arguments

RE: Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread John Carter -X (johncart - PolicyApp Ltd at Cisco)
The article explicitly mentions OOP interfaces in a few languages. But the article, or for that matter any formal definition of an interface isn't really what I asked about: My question was simply: why can't interfaces have properties? John. From: Nathan Nobbe

Re: [PHP-DEV] Return type hinting patch

2008-04-29 Thread Pierre Joye
On Tue, Apr 29, 2008 at 5:40 PM, Sam Barrow <[EMAIL PROTECTED]> wrote: > Mine uses less code to accomplish the same thing, doesn't introduce new > tokens, and has an easier syntax. Ok, sorry to have tried to get this feature in. I do think that going down the way you choosed right now is the best

Re: [PHP-DEV] Inheritance/compatibility behavior

2008-04-29 Thread Sam Barrow
On Tue, 2008-04-29 at 17:43 +0200, Stefan Walk wrote: > On Tuesday 29 April 2008 15:34:07 Sam Barrow wrote: > > > This will not work, I get an error that the two must be compatible. > > Wouldn't it be a good idea to allow any type hint for a parameter that > > does not specify a type hint? > > Th

Re: [PHP-DEV] Return type hinting patch

2008-04-29 Thread Sam Barrow
Mine uses less code to accomplish the same thing, doesn't introduce new tokens, and has an easier syntax. I'm still working on it, but I can give an update in a couple days. I just wanted to see what people thought about the implementation aspect of it. On Tue, 2008-04-29 at 17:37 +0200, Pierre Jo

Re: [PHP-DEV] Inheritance/compatibility behavior

2008-04-29 Thread Stefan Walk
On Tuesday 29 April 2008 15:34:07 Sam Barrow wrote: > This will not work, I get an error that the two must be compatible. > Wouldn't it be a good idea to allow any type hint for a parameter that > does not specify a type hint? That would be a bad idea, because it violates a (in my opinion, the) c

Re: [PHP-DEV] Return type hinting patch

2008-04-29 Thread Pierre Joye
On Tue, Apr 29, 2008 at 5:22 PM, Sam Barrow <[EMAIL PROTECTED]> wrote: > > Well in summation I think this is something that should be implemented, > I don't see any arguments against implementing this atleast for arrays > and classes, like we already have for function parameters. > > The only t

Re: [PHP-DEV] Return type hinting patch

2008-04-29 Thread Sam Barrow
Well in summation I think this is something that should be implemented, I don't see any arguments against implementing this atleast for arrays and classes, like we already have for function parameters. The only thing left would be to decide on the syntax public array function x() { // Probably t

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Jeff Moore
On Apr 29, 2008, at 3:15 AM, Sebastian Bergmann wrote: John Carter -X (johncart - PolicyApp Ltd at Cisco) schrieb: could you explain why Interfaces can't have properties Because interfaces are implemented which makes no sense for attributes. Sebastian, This is true for the data storage

Re: Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Nathan Nobbe
On Tue, Apr 29, 2008 at 6:28 AM, John Carter -X (johncart - PolicyApp Ltd at Cisco) <[EMAIL PROTECTED]> wrote: > > I think I must be missing something here, but this sounds a little > tautological - "we can't do it because it doesn't make sense. This is > because it doesn't make sense" > > Certain

Re: [PHP-DEV] Is there a difference in (n)make between windows and unix.

2008-04-29 Thread Wietse Venema
Steph Fox: > Hi Wietse, > > > This is a bug in PHP Makefiles. You can use the depend.php script > > that ships with my taint-for-PHP code. http://wiki.php.net/rfc/taint. > > > > To apply (on *n*x systems): > > That's not very helpful for Richard's Windows-specific query :) Excuse me for trying

Re: [PHP-DEV] Inheritance/compatibility behavior

2008-04-29 Thread Sam Barrow
On Tue, 2008-04-29 at 09:34 -0400, Sam Barrow wrote: > I want to make two classes: > > abstract class a { > abstract public function go($a); > } > final class b extends a { > abstract public function go(array $a); > } > Sorry, function in class b should not be abstract. > This will

[PHP-DEV] Inheritance/compatibility behavior

2008-04-29 Thread Sam Barrow
I want to make two classes: abstract class a { abstract public function go($a); } final class b extends a { abstract public function go(array $a); } This will not work, I get an error that the two must be compatible. Wouldn't it be a good idea to allow any type hint for a paramet

RE: Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread John Carter -X (johncart - PolicyApp Ltd at Cisco)
I think I must be missing something here, but this sounds a little tautological - "we can't do it because it doesn't make sense. This is because it doesn't make sense" Certainly most people (myself included) consider interfaces to be methods only, but I can't find a reason why not, and a search-

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Sebastian Bergmann
James Dempster schrieb: you should use getters and setters which you can define in interface BTW: An attribute with getter and setter is what I would call a property. -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277

RE: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread John Carter -X (johncart - PolicyApp Ltd at Cisco)
It might be bad design, but design is down to the application developer and not the people who define a language. I'm not necessary asking for the feature, I just want to understand why we can't do it. John. From: James Dempster [mailto:[EMAIL PROTECTED] Sen

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread James Dempster
I would start by saying it's bad design. you should use getters and setters which you can define in you interface -- /James On Tue, Apr 29, 2008 at 11:07 AM, John Carter -X (johncart - PolicyApp Ltd at Cisco) <[EMAIL PROTECTED]> wrote: > Marcus, > > I understand why Interfaces can't have bodies,

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Sebastian Bergmann
John Carter -X (johncart - PolicyApp Ltd at Cisco) schrieb: could you explain why Interfaces can't have properties Because interfaces are implemented which makes no sense for attributes. -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7

RE: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread John Carter -X (johncart - PolicyApp Ltd at Cisco)
Marcus, I understand why Interfaces can't have bodies, but could you explain why Interfaces can't have properties? Thanks, John. -Original Message- From: Marcus Boerger [mailto:[EMAIL PROTECTED] Sent: 29 April 2008 10:46 To: Jeremy Privett Cc: PHP Developers Mailing List Subject: Re:

Re: [PHP-DEV] Class Properties in Interfaces?

2008-04-29 Thread Marcus Boerger
Hello Jeremy, interfaces cannot have properties, nor can they have method bodies - that is the whole purpose of interfafces. We are thinking of adding traits which would allow for both but would treat inheritance differently. Until we get that you would need to provide an abstract interface to a

Re: [PHP-DEV] [PATCH] major bug in mmap of lexer

2008-04-29 Thread Antony Dovgal
On 29.04.2008 07:02, Gregory Beaver wrote: Hi, Today while testing phar with phpMyAdmin, I was getting a really weird error - one of the files was turning into a series of Z's, munging the entire display. Thinking it was a phar issue, I instead tracked it down to a major problem in an edge case

Re: [PHP-DEV] Is there a difference in (n)make between windows and unix.

2008-04-29 Thread Steph Fox
Hi Stas, Should editing ANY source level file (.h, .c type files) result in a make? Theoretically, it should. But it's as good as makefile dependencies, of course. I'm not sure PHP configure script generates dependencies for all files... I spent some time looking into this yesterday (Richa

Re: [PHP-DEV] Is there a difference in (n)make between windows and unix.

2008-04-29 Thread Steph Fox
Hi Wietse, This is a bug in PHP Makefiles. You can use the depend.php script that ships with my taint-for-PHP code. http://wiki.php.net/rfc/taint. To apply (on *n*x systems): That's not very helpful for Richard's Windows-specific query :) - Steph -- PHP Internals - PHP Runtime Development