Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Lerdorf
On 04/30/2013 05:17 PM, Rasmus Schultz wrote: > If the asterisk (or some other character) offers and easier > implementation path, whatever. It doesn't. This is a fringe feature, as evidenced by the fact that you are having a hard time convincing people that it is needed, and thus shouldn't overl

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
Okay, that is a technical/implementation problem - and I'm not the guy who can answer than question. I was thinking there might be a mathematical (or other) operator that doesn't work without something in front of it to operate on, and I chose the ^ operator based on a wild guess, plus the followi

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
> > one problem I have with this example is, that you usually (or at least > often) don't have a "$task" object here. I get what you're saying, but you do have a $task object if you want to use the form-builder, because it relies on the object for state. The same is true for most frameworks, and

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
On Tue, Apr 30, 2013 at 7:34 PM, Adam Harvey wrote: > I would caution against generalising use cases. Personally, ::class is > something I can use multiple times a day. This I'm not so sure about. > > Your use case is not my use case, and vice versa. :) > What is your use-case then? DI perhaps?

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Lerdorf
On 04/30/2013 03:24 PM, Rasmus Schultz wrote: > Are we really going to quibble about syntax? This adds nothing to this > discussion. And as I explained earlier, the ^ operator is used for the sake > of discussion only - if it's more practical to use another character for > this operator, I don't ca

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Sebastian Krebs
2013/5/1 Rasmus Schultz > Any PHP dev who works with a mainstream framework does this daily, but the > frameworks rely on strings for property-names. > > Take this example from the Symfony manual, for example: > > > class Task > { > protected $task; > > pro

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
I've already demonstrated and explained what's wrong with strings. "Weird indirection" is what we have in every mainstream framework right now, where properties can be referenced only as strings - I gave a real-world example of this, and demonstrated with a practical example how the proposed featu

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Adam Harvey
On 30 April 2013 16:15, Rasmus Schultz wrote: > At the risk of starting a separate discussion, the recently added > ClassName::class constant provides a way to statically reference a class, > which frankly has very few practical applications in comparison - the need > to reference properties is us

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Stas Malyshev
Hi! > Any PHP dev who works with a mainstream framework does this daily, but > the frameworks rely on strings for property-names. What's wrong with strings? Just because it doesn't have three levels of objects on it, doesn't mean it's not OK to use it. > We now have static property-references, w

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
I suggested something similar earlier: http://marc.info/?t=13632784962&r=1&w=2 However, I withdrew that idea, because I came to the realization that, for practical applications, you usually need the object-context coupled with the member-reference to do anything really useful. A form-input a

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Stas Malyshev
Hi! > In C#, they had the intention to introduce the operator infoof(...) to > get the reflection, not only of properties, but of virtually everything > in the language. They abandoned the idea because it is really hard to do > that for overloaded functions and they did not want to do all that wor

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
Any PHP dev who works with a mainstream framework does this daily, but the frameworks rely on strings for property-names. Take this example from the Symfony manual, for example: class Task { protected $task; protected $dueDate; public functio

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Lazare Inepologlou
2013/4/30 Rasmus Lerdorf > On 04/30/2013 01:58 PM, Stas Malyshev wrote: > > Hi! > > > >> I'm proposing we need a way to statically reference an object property - > >> the object property itself, not it's value: > > > > You probably have use case for that, and it should be pretty easy to > > write

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Lerdorf
On 04/30/2013 01:58 PM, Stas Malyshev wrote: > Hi! > >> I'm proposing we need a way to statically reference an object property - >> the object property itself, not it's value: > > You probably have use case for that, and it should be pretty easy to > write a class that does that, but why it shoul

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Stas Malyshev
Hi! > I'm proposing we need a way to statically reference an object property - > the object property itself, not it's value: You probably have use case for that, and it should be pretty easy to write a class that does that, but why it should be in the language? It certainly doesn't look like some

[PHP-DEV] Re: [lists.php] Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
I don't think that's necessary - the point of being able to do this, is to apply meta-programming techniques, so in most situations, what matters is the ability to quickly create object/property-references... using them will usually happen inside some service component, e.g. a form-helper or object

[PHP-DEV] Re: [lists.php] Re: [PHP-DEV] property de-referencing

2013-04-30 Thread ALeX
Just an idea: why not also use ^ (or another operator) to access the value? (maybe as an additional way to get/setValue) $foo = ^$user->name; echo 'Hello '.^$foo; ^$foo = 'Bob'; (using the same operator will conflict when you are accessing a property of an object which is a PropertyReference) -

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
That looks more pointless than evil to me - and no, I'm not suggesting anything of that sort. I'm proposing we need a way to statically reference an object property - the object property itself, not it's value: var_dump($user->name); // => 'Rasmus' var_dump(^$user->name); // => PropertyR

Re: [PHP-DEV] Continued try blocks

2013-04-30 Thread Pierre Joye
hi, On Tue, Apr 30, 2013 at 7:54 PM, Stas Malyshev wrote: >> You may have a lib/object/chunk of code which raises exceptions, because >> its developer thought some error is not recoverable; but when you use >> it, you don't want to break your program's execution. > > That's why you have try/catc

Re: [PHP-DEV] Continued try blocks

2013-04-30 Thread Stas Malyshev
Hi! > It's a point of view, not something the language should enforce. It is a point of view that any proper language should enforce. Languages always enforce certain style, certain ideas and certain paradigm - be it computer languages or natural languages. You can decide from now on in your lang

Re: [PHP-DEV] [RFC] Class instances counter

2013-04-30 Thread Patrick ALLAERT
2013/4/10 Frank Liepert : > Hello internals, > > again an update on the RFC, see https://wiki.php.net/rfc/instance_counter: > > - added support for object as argument > - added support for array argument (indexed array with class names) > - added more code examples > > > -- > PHP Internals - PHP Ru

Re: [PHP-DEV] PDO Extension contributions

2013-04-30 Thread Ferenc Kovacs
2013.04.26. 20:04, "Guilherme Capilé" ezt írta: > > Ola, > > my name is Guilherme Capilé, I'm a Brazilian developer and I'd like to > contribute to the PHP-SRC. Right now, specifically to the PDO DBLIB > (ext/pdo_dblib) extension. I've already submitted a bug, a patch and a > pull request, a month

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Ferenc Kovacs
2013.04.30. 14:00, "Rasmus Schultz" ezt írta: > > > > > Do you mean something yucky like http://pecl.php.net/propro? > > > > > I don't know what that is, and there is no description on that page. you can grasp the concept from the testcase: http://git.php.net/?p=pecl/php/propro.git;a=blob_plain;f

Re: [PHP-DEV] Continued try blocks

2013-04-30 Thread Amaury Bouchard
2013/4/29 Stas Malyshev > I agree. If your code can handle the problem, it should not throw. If it > throws, the control should not go back there, since the code already > gave up and declared it can not continue doing whatever it was doing. > Exceptions are meant to handle exceptional situations

[PHP-DEV] Pull request status

2013-04-30 Thread Jason Gerfen
Hello, I realize testing and bug fixes are taking place for the latest beta release, so I apologize in advance if everyone is fairly busy. I was just checking on the status of pull request #267 ( https://github.com/php/php-src/pull/267) addressing bug report #38917 ( https://bugs.php.net/bug.php?i

Re: [PHP-DEV] [VOTE] Class instances counter

2013-04-30 Thread Peter Cowburn
On 30 April 2013 12:17, Pierre Joye wrote: > hi! > > Did I miss the discussions about this feature? > It was easy to miss, but a *very minimal* discussion happened towards the beginning of April. See "[RFC] Class instances counter" -- http://markmail.org/thread/o6vsxx6yj4ezh5f6 > > Cheers, >

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Rasmus Schultz
> > Do you mean something yucky like http://pecl.php.net/propro? > > I don't know what that is, and there is no description on that page. > It's actually been meant to be used by extensions for internal properties, >> but it might do the evil you're looking for. > > Would you care to elaborate? W

[PHP-DEV] Re: [lists.php] Re: [PHP-DEV] Re: [lists.php] [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-30 Thread ALeX
> There are some weird questions that come up with that. For example, if an > array item is an object that implements both __invoke() and __toString(), > which should be fired? Is it a string? Or a callback? What if I pass a > literal string "strlen", is that a callback, or a replacement? You're r

Re: [PHP-DEV] Re: [lists.php] [PHP-DEV] [PROPOSAL]Add second to callback of preg_replace_callback

2013-04-30 Thread Anthony Ferrara
ALeX, On Mon, Apr 29, 2013 at 5:53 PM, ALeX wrote: > what about patch preg_replace to accept callbacks? > > example: > preg_replace(array( > "/pattern1(.*)/", > "/pattern2(.*)/" >), >array( >function ($pat) { ... } , > "replace" > ) > , ... ); > > The

Re: [PHP-DEV] [VOTE] Class instances counter

2013-04-30 Thread Pierre Joye
hi! Did I miss the discussions about this feature? Cheers, On Tue, Apr 30, 2013 at 10:04 AM, Frank Liepert wrote: > See https://wiki.php.net/rfc/instance_counter#vote > > Voting starts as of now and ends on 7th May, 2013. > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsu

[PHP-DEV] [VOTE] Class instances counter

2013-04-30 Thread Frank Liepert
See https://wiki.php.net/rfc/instance_counter#vote Voting starts as of now and ends on 7th May, 2013. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] property de-referencing

2013-04-30 Thread Michael Wallner
On 30 April 2013 01:45, Rasmus Schultz wrote: > The characters was an arbitrary choice, just for the sake of argument. > > I'm not a C programmer, so I don't have a patch - there is also no RFC, but > there is general interest, I'd be happy to write one. > > On Mon, Apr 29, 2013 at 5:22 AM, Lars