Re: [PHP-DEV] file streams & metadata

2011-03-13 Thread Stas Malyshev

Hi!

Here's an RFC:
http://wiki.php.net/rfc/streammetadata

Patch link inside.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] native php annotations

2011-03-13 Thread Pierre Joye
On Sun, Mar 13, 2011 at 11:02 PM, Marcelo Gornstein  wrote:
>> I don't believe the patch was anywhere near an accepted state back then,
>> sadly.
> Are you saying there wont be annotations in PHP? Is there any way to
> contribute to make this feature accepted and available?

No, only that no compromise has been reached on annotation support.


-- 
Pierre

@pierrejoye | http://blog.thepimp.net | http://www.libgd.org

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] native php annotations

2011-03-13 Thread Ben Schmidt

On 14/03/11 8:47 AM, Marcelo Gornstein wrote:

it has already been discussed with length. Please take a look at:

http://wiki.php.net/rfc/annotations

Thank you for the link. That is actually pretty much what I intended
to do. The only difference with my own version lies in the possibility
to annotate method parameters (very useful in many cases when using an
IoC/DI container). So that would be my 2 cents there.


I haven't read the RFC, but what you suggested in your earlier email
looked good to me, and I like the idea, so I'd be in favour of doing
something. (I'm new here, too, and not a core dev or anything, so my
opinion doesn't and shouldn't carry much weight, but there it is.)

Ben.



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] native php annotations

2011-03-13 Thread Marcelo Gornstein
> I don't believe the patch was anywhere near an accepted state back then,
> sadly.
Are you saying there wont be annotations in PHP? Is there any way to
contribute to make this feature accepted and available?

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] native php annotations

2011-03-13 Thread Etienne Kneuss
On Mar 13 18:47:38, Marcelo Gornstein wrote:
> > it has already been discussed with length. Please take a look at:
> >
> > http://wiki.php.net/rfc/annotations
> Thank you for the link. That is actually pretty much what I intended
> to do. The only difference with my own version lies in the possibility
> to annotate method parameters (very useful in many cases when using an
> IoC/DI container). So that would be my 2 cents there.
> 
> I made the patch because it's a feature I wanted from a long time now,
> and didn't find anything done about it. Do you know if this rfc is
> going to be approved?

The main concern with the proposals above were:

1) the syntax

2) how to represent the data (i.e. objects)

3) if objects, when to instanciate them, when reflecting, once?

I don't believe the patch was anywhere near an accepted state back then,
sadly.

Best,

> 
> Thanks again for your quick reply,

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] native php annotations

2011-03-13 Thread Marcelo Gornstein
> it has already been discussed with length. Please take a look at:
>
> http://wiki.php.net/rfc/annotations
Thank you for the link. That is actually pretty much what I intended
to do. The only difference with my own version lies in the possibility
to annotate method parameters (very useful in many cases when using an
IoC/DI container). So that would be my 2 cents there.

I made the patch because it's a feature I wanted from a long time now,
and didn't find anything done about it. Do you know if this rfc is
going to be approved?

Thanks again for your quick reply,

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] SplFileObject Countable

2011-03-13 Thread Etienne Kneuss
On Mar 11 23:22:04, Sebastian Marek wrote:
> Hi,
> 
> I have recently used SplFileObject to work with files. I was lacking a bit
> of functionality in there regarding counting number of lines in a given
> file. Although I could just load contents of the file to an array and check
> it size, I thought it would be nice to have SplFileObject Countable.
> 
> Here is an example implementation I made tonight that seems to work well -
> https://gist.github.com/866767 . Is it something you think would be worth
> adding to the existing SplFileObject? Is the implementation any good? I
> reused some of the existing logic to avoid breaking 'spl_filesystem_object'
> internal integrity, but maybe it would make sense to make it work with the
> stream itself.

In my oppinion, it does not make sense to implement countable for this
use. Countable should be implemented on classes where calling count() on
them is not ambiguous, i.e. the size of a collection.

There is no reason why count() on a file should be the number of lines,
why not words, or bytes?

I'd however be happy with a new countLines() method.

Best,

> 
> If it's fine I can write some unit tests to cover this and then submit a
> complete patch.
> 
> Regards
> -- 
> Sebastian Marek
> proo...@gmail.com
> 
> Follow me online at:
> Blog: http://criticallog.thornet.net/
> Twitter: http://twitter.com/proofek
> Linkedin: http://uk.linkedin.com/in/sebastianmarek
> Ohloh: http://www.ohloh.net/accounts/proofek
> 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] native php annotations

2011-03-13 Thread Etienne Kneuss
On Mar 13 17:50:33, Marcelo Gornstein wrote:
> Hello All,
> 
> I'm new to this list, so please excuse me if this subject was already
> discussed, or proposed.

Hi,

it has already been discussed with length. Please take a look at:

http://wiki.php.net/rfc/annotations

it would be more productive if you explain in what ways your proposal
differs from the one above, and why that should be so.

Best,

> 
> I've made an experimental patch to ZendEngine/PHP (5.3.5) to allow
> native annotations (without doc comments), using the token @@ (the @
> was already taken). It allows 0 or more annotations (with 0 or more
> arguments each one) for classes, properties, methods, and arguments
> for methods, like:
> 
> @@Annotation(key="value1")
> class A {
> @@Annotation(key="value1")
> private $property;
> 
> @@Annotation(key="value1")
> private function aMethod(@@Annotation(key="value1") @@Annotation2 $a, $b) 
> {
> ...
> }
> }
> 
> The patch can be found at: https://github.com/marcelog/AnoForPHP.
> 
> The annotations and their optional arguments can be retrieved via the
> getAnnotations() method of ReflectionClass, ReflectionMethod,
> ReflectionParameter, and ReflectionProperty.
> 
> I plan to extend this patch with some extended functionality, like
> having PHP instantiate a given class for the given annotation. By
> using convention instead of configuration, the name of the annotation
> is the name of the class, which should also extend some PHP base
> class, like "Annotation".
> 
> I'm basically looking for comments on the patch and the functionality,
> since I'm new to the ZendEngine as well.
> 
> Again, I'm sorry if this post should not go here or there is not
> interest in such a feature in the language itself. Also, if I missed
> something in the code of the patch, because it's more like a
> proof-of-concept than a final formal proposal.
> 
> Regards!
> 
> 
> --
> // I don't sleep. I coffee.
> "Make everything as simple as possible, but not simpler." -- Albert Einstein
> "The class object inherits from Chuck Norris."
> "Chuck Norris can divide by zero and can unit test an entire
> application with a single assert."
> "There’s a lot of work happening behind the scenes, courtesy of the
> Spring AOP framework"
> "Why do I have this nagging hunch that you have no idea what you're doing?"
> "Any society that would give up a little liberty to gain a little
> security will deserve neither and lose both" - Benjamin Franklin
> 
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] native php annotations

2011-03-13 Thread Marcelo Gornstein
Hello All,

I'm new to this list, so please excuse me if this subject was already
discussed, or proposed.

I've made an experimental patch to ZendEngine/PHP (5.3.5) to allow
native annotations (without doc comments), using the token @@ (the @
was already taken). It allows 0 or more annotations (with 0 or more
arguments each one) for classes, properties, methods, and arguments
for methods, like:

@@Annotation(key="value1")
class A {
@@Annotation(key="value1")
private $property;

@@Annotation(key="value1")
private function aMethod(@@Annotation(key="value1") @@Annotation2 $a, $b) {
...
}
}

The patch can be found at: https://github.com/marcelog/AnoForPHP.

The annotations and their optional arguments can be retrieved via the
getAnnotations() method of ReflectionClass, ReflectionMethod,
ReflectionParameter, and ReflectionProperty.

I plan to extend this patch with some extended functionality, like
having PHP instantiate a given class for the given annotation. By
using convention instead of configuration, the name of the annotation
is the name of the class, which should also extend some PHP base
class, like "Annotation".

I'm basically looking for comments on the patch and the functionality,
since I'm new to the ZendEngine as well.

Again, I'm sorry if this post should not go here or there is not
interest in such a feature in the language itself. Also, if I missed
something in the code of the patch, because it's more like a
proof-of-concept than a final formal proposal.

Regards!


--
// I don't sleep. I coffee.
"Make everything as simple as possible, but not simpler." -- Albert Einstein
"The class object inherits from Chuck Norris."
"Chuck Norris can divide by zero and can unit test an entire
application with a single assert."
"There’s a lot of work happening behind the scenes, courtesy of the
Spring AOP framework"
"Why do I have this nagging hunch that you have no idea what you're doing?"
"Any society that would give up a little liberty to gain a little
security will deserve neither and lose both" - Benjamin Franklin

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php