Re: [PHP-DEV] Traits and static methods

2010-11-16 Thread Stefan Marr
Hi Simas: On 17 Nov 2010, at 07:32, Simas Toleikis wrote: > Alright then, I am sure someone will find more uses for static methods in > Traits like factories/utilities (especially if traits can be made to work > with late static binding). > > I assume this will be implemented in one way or anothe

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) supportdiscussion

2010-11-16 Thread Dave Ingram
On 17/11/10 06:38, Will Fitch wrote: > I like the idea, Alec. > > My only question is, syntactically, what difference would using a keyword, > in this case "attribute", as opposed to brackets "[]"? I would say that it provides better searchability -- it's easier for people new to the feature to re

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) supportdiscussion

2010-11-16 Thread Dave Ingram
On 16/11/10 21:56, Alec wrote: > [snip] > > attribute RestMethod('/do/something', 'Do Stuff', 'Does something.', > array( > 'arg1' => 'A cool argument!' > )); > public static DoSomething($arg1) { > ... > > or > > attribute Example('arg', 'arg2', 3, (time() > 0 ? true : false)); > class Demo {

Re: [PHP-DEV] Traits and static methods

2010-11-16 Thread Simas Toleikis
Hi Ferenc, for reusable singleton pattern with php 5.3 > http://www.slideshare.net/fabpot/design-patternrevisitedphp53 > slide 11 and 12 > As Tom already pointed out - there is that lock-down of your parent(s) to singletons with this type of implementation and there are other shortcomings when u

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) supportdiscussion

2010-11-16 Thread Will Fitch
I like the idea, Alec. My only question is, syntactically, what difference would using a keyword, in this case "attribute", as opposed to brackets "[]"? On Tue, Nov 16, 2010 at 9:38 PM, Alec Gorge wrote: > Ah, thanks. > > This is my proposed syntax and examples of it being used: > https://gist.

Re: [PHP-DEV] Traits and static methods

2010-11-16 Thread Simas Toleikis
Hi Stefan, Following the motto 'it is just compiler assisted copy and paste' I think > it should be implemented. > Alright then, I am sure someone will find more uses for static methods in Traits like factories/utilities (especially if traits can be made to work with late static binding). I ass

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) supportdiscussion

2010-11-16 Thread Alec Gorge
Ah, thanks. This is my proposed syntax and examples of it being used: https://gist.github.com/702925 Here is my answer to those questions: - PHP code - See the gist for syntax - Return object instances of the annotation because then you can call methods on the annotation if you need to (it t

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread guilhermebla...@gmail.com
Hi Gustavo, Normal instantiation cannot be done. Here is a sample where it would fail: new Foo() class User { ... } So it must be something different. []s, On Wed, Nov 17, 2010 at 1:07 AM, Gustavo Lopes wrote: > On Wed, 17 Nov 2010 01:54:22 -, Stas Malyshev > wrote: > >> The problem is n

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread Gustavo Lopes
On Wed, 17 Nov 2010 01:54:22 -, Stas Malyshev wrote: The problem is not new syntax per se. The problem is new syntax for things that already have old syntax. This is incontestably false. Although a big portion of the use cases can awkwardly use the user-space parsed and interpreted d

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) supportdiscussion

2010-11-16 Thread guilhermebla...@gmail.com
Hi Alec, Here is the quick list: - Where to put the metadata information? docblock or though php code? - Syntax (based on first decision) - Return would be an array or object instances - Compile time or run time (decision is more about APC being able to cache, but instances being created at runtim

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) supportdiscussion

2010-11-16 Thread Alec Gorge
In my opinion (as a person with 0 karma), I think that sounds reasonable because most people are most concerned about the actual implementation (syntax, performance, apc etc) because I don't think many argue that Metadata doesn't have value. What are the 5 different discussion topics you are t

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) supportdiscussion

2010-11-16 Thread guilhermebla...@gmail.com
Hi Stas, Ok, so you think I should just consider everyone want some sort of meta attribute support and start discussing the topics? Should I separate it in different threads or put it all here? The subject is big and I identify at least 5 different discussions that can diverge. Cheers, On Wed,

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) supportdiscussion

2010-11-16 Thread Stas Malyshev
Hi! I'm able to write 10 RFC's, but none will care until we reach this list with a patch. Not entirely true. Patch helps, but with feature this big and complex having consensus on design before actually implementing it may be better and save you some time. As for polls, I think generic "havi

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread Stanley Sufficool
-1 I won't be using it. I won't argue on this thread since it is a +/- vote on the idea of Annotations, not the proposed implementation of it. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) supportdiscussion

2010-11-16 Thread guilhermebla...@gmail.com
Hi Stas, A full RFC will be written based on results of polls. I'm able to write 10 RFC's, but none will care until we reach this list with a patch. So instead of lose time, I prefer to discuss what can be done here, write an RFC then finally implement it. But without having feedback from core de

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) supportdiscussion

2010-11-16 Thread Alec Gorge
Ok, I will do that. I already have some code examples worked up from earlier. I have just registered on the wiki (same email as here). Are you able to give me access to the rfc namespace so I start the rfc? Also, do you want me to start a new thread or just post the rfc as a reply to this th

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) supportdiscussion

2010-11-16 Thread Stas Malyshev
Hi! I think my reply ( http://article.gmane.org/gmane.comp.php.devel/63203 ) addresses this. It doesn't introduce any new language constructs per se. You could make it even more standard and clear by adding "new" after "annotation". How about making it a full RFC? It's kind of hard to keep tra

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) supportdiscussion

2010-11-16 Thread Alec
I think my reply ( http://article.gmane.org/gmane.comp.php.devel/63203 ) addresses this. It doesn't introduce any new language constructs per se. You could make it even more standard and clear by adding "new" after "annotation". Just as a thought: instead of annotation, metadata could also be

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread Stas Malyshev
Hi! I would have no trouble accepting a rejection of annotations on the actual merits, but the interminable sequence of comparisons to phpdoc make it clear to me that people just don't realize the potential of annotations. People do realize the potential, what you and many "+1" voters seem to

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread Stas Malyshev
Hi! Poll will be opened for voting for 7 days (1 week) starting from now. Poll will be closed next Monday at 5pm GMT. Question: Does PHP need meta attribute support? Unless there's a simple way of describing it - without adding a lot of complexity and introducing multiple new syntax construct

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) supportdiscussion

2010-11-16 Thread Alec
But, in my opinion at least, parsing docblocks also brings in a new syntax. The only difference that I see is that parsing docblocks is wrapped in a comment and not syntax highlighted by most editors. Just out of curiosity, how did traits make it into 5.4 if we are avoiding syntax changes? You

Re: [PHP-DEV] Traits and static methods

2010-11-16 Thread Tom Sartain
On Tue, Nov 16, 2010 at 3:55 PM, Ferenc Kovacs wrote: > > for reusable singleton pattern with php 5.3 > http://www.slideshare.net/fabpot/design-patternrevisitedphp53 > slide 11 and 12 > > Tyrael > The problem with the solution presented in the slides is that it limits every singleton class to onl

Re: [PHP-DEV] Traits and static methods

2010-11-16 Thread Ferenc Kovacs
On Tue, Nov 16, 2010 at 6:46 PM, Simas Toleikis wrote: > Hello, > > I was just skimming through Traits RFC document on the wiki trying to find > a > practical use for them. The first thing that comes to my mind is a > Singleton > implementation - this is where I found myself literally "copying" m

Re: [PHP-DEV] Traits and static methods

2010-11-16 Thread Stefan Marr
Hi Simas: On 16 Nov 2010, at 18:46, Simas Toleikis wrote: > The first thing that comes to my mind is a Singleton > implementation - this is where I found myself literally "copying" most of > the code in the past. As far as I know there is no way to implement this > pattern properly in PHP without

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread Paul M Jones
On Nov 16, 2010, at 13:27 , Ferenc Kovacs wrote: > On Tue, Nov 16, 2010 at 6:55 PM, Chad Fulton wrote: > >> I understand where you're coming from, and I appreciate the effort >> you've put into this RFC so far, but what I meant is that (although I >> don't have karma and won't be voting), *if*

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread Ferenc Kovacs
On Tue, Nov 16, 2010 at 6:55 PM, Chad Fulton wrote: > I understand where you're coming from, and I appreciate the effort > you've put into this RFC so far, but what I meant is that (although I > don't have karma and won't be voting), *if* I were to vote, I would > only +1 annotations if they were

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread Chad Fulton
I understand where you're coming from, and I appreciate the effort you've put into this RFC so far, but what I meant is that (although I don't have karma and won't be voting), *if* I were to vote, I would only +1 annotations if they were extremely limited (key=>value pairs). That's why implementati

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread guilhermebla...@gmail.com
I don't wanna be bad interpreted or considered as rude, but I wonder why is it so hard for all of you to just vote instead of stay crying like lost babies. PHP is open for everyone to contribute, I want to help it but it seems impossible to help language move forward without people that accept glob

Re: [PHP-DEV] svn: /php/php-src/trunk/ UPGRADING.INTERNALS ext/standard/basic_functions.c ext/standard/basic_functions.h main/php_streams.h main/streams/memory.c main/streams/streams.c

2010-11-16 Thread Gustavo Lopes
On Mon, 15 Nov 2010 07:25:44 -, Kalle Sommer Nielsen wrote: 2010/11/15 Gustavo André dos Santos Lopes : cataphract Mon, 15 Nov 2010 03:05:32 + Revision: http://svn.php.net/viewvc?view=revision&revision=305346 Log: - Added leak_variable() function. Wh

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread Gustavo Lopes
On Tue, 16 Nov 2010 17:37:44 -, Chad Fulton wrote: I also don't think you can discuss annotations without simultaneously discussing their implementation. To me, it looks like you're trying to force through a vote on a very vague topic "should PHP support Annotations", and then use that vo

Re: [PHP-DEV] Re: [PHP-CVS] svn: /php/php-src/trunk/ UPGRADING.INTERNALS ext/standard/basic_functions.c ext/standard/basic_functions.h main/php_streams.h main/streams/memory.c main/streams/streams.c

2010-11-16 Thread Gustavo Lopes
On Mon, 15 Nov 2010 08:25:44 +0100, Kalle Sommer Nielsen wrote: 2010/11/15 Gustavo André dos Santos Lopes : cataphract Mon, 15 Nov 2010 03:05:32 + Revision: http://svn.php.net/viewvc?view=revision&revision=305346 Log: - Added leak_variable() function. Why

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread guilhermebla...@gmail.com
@Chad: You're getting me wrong here. If results of poll decide for OK to meta attribute support, next poll would be which implementation to choose. I can find 3 different implementations that we can choose, but anyone is free to contribute. - Docblock /** @Foo */ class User { ... } - New syntax

[PHP-DEV] Traits and static methods

2010-11-16 Thread Simas Toleikis
Hello, I was just skimming through Traits RFC document on the wiki trying to find a practical use for them. The first thing that comes to my mind is a Singleton implementation - this is where I found myself literally "copying" most of the code in the past. As far as I know there is no way to imple

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread Chad Fulton
On Tue, Nov 16, 2010 at 6:03 AM, Lars Schultz wrote: > Hi, > > I certainly don't have PHP-Karma (Does meritocracy really refer to that?), > but simply I can't believe that you're talking about this, again. > > I think Annotation-Supporters have made their point, but shouldn't they let > the PHP 5.

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread Gustavo Lopes
On Tue, 16 Nov 2010 07:06:27 -, Zeev Suraski wrote: From: Pierre Joye [mailto:pierre@gmail.com] Sent: Tuesday, November 16, 2010 1:45 AM To: Zeev Suraski Cc: guilhermebla...@gmail.com; PHP internals Subject: Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

RE: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread Mike Robinson
November-16-10 2:21 AM - Zeev Suraski wrote: > Like I said – of course annotations bring value. If that was the only > property when evaluating a new feature to be added, PHP would very > quickly become an everything-and-the-kitchen-sink language. > Thankfully, it’s not. Amen. -1 Best Regards

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread Lester Caine
guilhermebla...@gmail.com wrote: Hi Lester, If you READ my first email of this thread, you'll find out I do not speak about new syntax, etc. No matter if you say "that can be done through docblock", you're automatically saying +1 to this thread. Please re-read the topic and vote. Thanks. Doe

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread guilhermebla...@gmail.com
Hi Lester, If you READ my first email of this thread, you'll find out I do not speak about new syntax, etc. No matter if you say "that can be done through docblock", you're automatically saying +1 to this thread. Please re-read the topic and vote. Thanks. Cheers, On Tue, Nov 16, 2010 at 5:38

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread guilhermebla...@gmail.com
Hi Zeev, On Tue, Nov 16, 2010 at 5:10 AM, Zeev Suraski wrote: > I hope I won't stir the pot too much, but with all due respect to the vote of > at-best a two digit subset of an arbitrary 3000+ subscribers to internals, > there's an overwhelming majority amongst the principal developers of PHP t

Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion

2010-11-16 Thread Richard Quadling
On 16 November 2010 07:06, Zeev Suraski wrote: >> -Original Message- >> From: Pierre Joye [mailto:pierre@gmail.com] >> Sent: Tuesday, November 16, 2010 1:45 AM >> To: Zeev Suraski >> Cc: guilhermebla...@gmail.com; PHP internals >> Subject: Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. A

Re: [PHP-DEV] Adding path_len to all stream functions in trunk

2010-11-16 Thread Pierre Joye
hi, On Tue, Nov 16, 2010 at 7:15 AM, Rasmus Lerdorf wrote: > On 11/15/10 10:12 PM, Stas Malyshev wrote: >> Hi! >> >>> Well, it changes the signature of that function, so while we don't break >>> backward binary compatibility, we break forward compatibility within the >>> 5.3 branch.  As in, if I

Re: [PHP-DEV] Adding path_len to all stream functions in trunk

2010-11-16 Thread Pierre Joye
On Tue, Nov 16, 2010 at 6:07 AM, Stas Malyshev wrote: > Hi! > >> Yeah, I thought about that too.  Still not something we can do without >> breaking binary compatibility in the 5.3 branch though and I really >> would like to at least get all the core functions to guard themselves >> against null-po

Re: [PHP-DEV] Adding path_len to all stream functions in trunk

2010-11-16 Thread Rasmus Lerdorf
On 11/16/10 1:44 AM, Derick Rethans wrote: > On Mon, 15 Nov 2010, Rasmus Lerdorf wrote: > >> Ok, I went through all the 5.3 code. This should fix the null poisoning >> problems in 5.3 without breaking binary compatibility: >> >> http://progphp.com/nullpatch.txt >> >> There are quite a few places

Re: [PHP-DEV] Adding path_len to all stream functions in trunk

2010-11-16 Thread Derick Rethans
On Mon, 15 Nov 2010, Rasmus Lerdorf wrote: > Ok, I went through all the 5.3 code. This should fix the null poisoning > problems in 5.3 without breaking binary compatibility: > > http://progphp.com/nullpatch.txt > > There are quite a few places where we can't solve it centrally, so > perhaps we

Re: [PHP-DEV] Adding path_len to all stream functions in trunk

2010-11-16 Thread Johannes Schlüter
On Mon, 2010-11-15 at 02:42 -0800, Rasmus Lerdorf wrote: > Ok, I went through all the 5.3 code. This should fix the null poisoning > problems in 5.3 without breaking binary compatibility: > > http://progphp.com/nullpatch.txt I didn't check it as I'm on vacation traveling right now, but: Does the

Re: [PHP-DEV] Adding path_len to all stream functions in trunk

2010-11-16 Thread Rasmus Lerdorf
Yes, you could say that users should just know to filter, and if we were able to pass the binary string through and had binary-safe filesystem calls, I could agree that we wouldn't need to do anything, but the current default of truncating at the null byte is dangerous. Compare these: % echo '/et

Re: [PHP-DEV] Adding path_len to all stream functions in trunk

2010-11-16 Thread Dmitry Stogov
hi, don't we have ext/filter that should check all the dangerous input strings? It would be useless to perform additional checks for constant stings known at compile time (e.g. on include "foo.php") Thanks. Dmitry. Rasmus Lerdorf wrote: On 11/15/10 10:12 PM, Stas Malyshev wrote: Hi! Well