Good developers research and find *best* ways to use the available tools
before inventing new ones.
On Mon, May 6, 2013 at 2:46 PM, Rasmus Schultz ras...@mindplay.dk wrote:
Well, I don't disagree as such - there's any number of (mostly bad) ways
to work around missing language features...
And what do good developers do when the best ways have long since been
identified - and the limitations of the language prevents them from
implementing any new ideas?
I have hundreds of PHP experiments collected in a sandbox over the years -
a good way to build and handle web-forms is one of the
Maybe PHP is just not for you. There are other languages in the sea :)
On Tue, May 7, 2013 at 10:32 AM, Rasmus Schultz ras...@mindplay.dk wrote:
And what do good developers do when the best ways have long since been
identified - and the limitations of the language prevents them from
I have tried tons of other languages, actively watching at least a few
others in the hopes they'll mature - but I keep coming back to PHP for some
reason.
It's an abusive relationship. Maybe I should seek counseling ;-)
On Tue, May 7, 2013 at 11:15 AM, Seva Lapsha seva.lap...@gmail.com wrote:
I am really surprised that there is so few people interested in such a
feature. IMO, it's an amazing idea, not just for forms, and not just for
properties.
Here is a quick list of use cases where one would use meta on its code:
- Forms generation (examples have already been given)
- ORM
I am really surprised that there is so few people interested in such a
feature. IMO, it's an amazing idea, not just for forms, and not just for
properties.
It's not that the idea isn't useful; I just don't think I need a dedicated
syntax for it. If we're going to be adding syntax I'd much
Hi Rasmus,
I agree with you that strings are not the best way to refer to an element
sometimes. However, to me your Symfony2 example only demonstrates the flaw
of the component's design decision, not the limitation of the language.
Sometimes developers (not just Symfony, but other frameworks too)
Seva,
I understand that you can reference properties more consistently
using {fullClassName}::{fieldName} notation, but it's still a string, and
although it's now almost practically safe to assume that strings formatted
in that way are property-references, it still doesn't address the problem
in
Not elegant - true, not expressive - I don't agree.
My reference to Java was not to point how things should be, but how people
find *proper* ways to overcome missing edge features of a language.
On Mon, May 6, 2013 at 12:44 PM, Rasmus Schultz ras...@mindplay.dk wrote:
Seva,
I understand
BTW, I didn't propose to wrap any use of a property reference into a meta
object, in this case a certain distinguishable string format could
represent it with no extra handling.
On Mon, May 6, 2013 at 12:44 PM, Rasmus Schultz ras...@mindplay.dk wrote:
Seva,
I understand that you can
Well, I don't disagree as such - there's any number of (mostly bad) ways to
work around missing language features...
On Mon, May 6, 2013 at 1:12 PM, Seva Lapsha seva.lap...@gmail.com wrote:
BTW, I didn't propose to wrap any use of a property reference into a meta
object, in this case a certain
2013/5/2 Bernhard Schussek bschus...@gmail.com
2013/5/1 Rasmus Schultz ras...@mindplay.dk
One could
write a PropertyReference class right now with literally the only
difference being the lack of a builtin operator (ie new
PropertyReference($obj, 'prop') versus ^$obj-prop): the fact
That's an interesting spin on the idea, but it takes away the ability to
lazy-evaluate an entire path - now it works only for the last property,
which may not always be optimal or desirable.
I don't personally have a problem with putting the operator before the
expression, I think that's clear
On Fri, May 3, 2013 at 1:32 PM, Rasmus Schultz ras...@mindplay.dk wrote:
That's an interesting spin on the idea, but it takes away the ability to
lazy-evaluate an entire path - now it works only for the last property,
which may not always be optimal or desirable.
I don't personally have a
2013/5/1 Rasmus Schultz ras...@mindplay.dk
One could
write a PropertyReference class right now with literally the only
difference being the lack of a builtin operator (ie new
PropertyReference($obj, 'prop') versus ^$obj-prop): the fact that
nobody seems to have done this in a major
*An:* Robert Stoll
*Cc:* Etienne Kneuss; Rasmus Lerdorf; Stas Malyshev; PHP internals
*Betreff:* Re: [PHP-DEV] property de-referencing
** **
PhpStorm has the finest refactoring support you can achieve with the
limited amount of static information in PHP source-code, plus hopefully
authors[0].personalDetails[firstName]
which translates to
-getAuthors()[0]-getPersonalDetails()['firstName']
It's indirection via strings.
This particular example isn't great for what I'm proposing, because you're
not accessing a property - using an array-index, you get a value. There
Oh, here's a thought: let's just throw more annotations at it?
$config = /** @ref AppConfiguration */ array(
'services' = /** @ref ServiceContainer */ array(
/** @ref PDO */ array(
'username' = 'foo',
'password' = 'bar',
)
),
);
This would work -
a shorthand for “new PropertyReference($user, 'name');”?
Von: Rasmus Schultz [mailto:ras...@mindplay.dk]
Gesendet: Donnerstag, 2. Mai 2013 14:14
An: Robert Stoll
Cc: Etienne Kneuss; Rasmus Lerdorf; Stas Malyshev; PHP internals
Betreff: Re: [PHP-DEV] property de-referencing
As you described, IDEs
Hello,
2013/5/1 Stas Malyshev smalys...@sugarcrm.com
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
Hi,
Lazare Inepologlou
Mittwoch, 1. Mai
2013 10:55
Hello,2013/5/1
Stas Malyshev smalys...@sugarcrm.comThe
result is the same with "new ReplectionMethod('foo','bar')". The addedvalue
is that it can be statically checked.
well... yes and no.
Take the Symfony2 example:
This won't work, because Task::$task is a protected property
It will work for code that's properly documented with @property annotations.
On Wed, May 1, 2013 at 7:05 AM, Jannik Zschiesche he...@apfelbox.netwrote:
Hi,
Lazare Inepologlou linep...@gmail.com
Mittwoch, 1. Mai 2013 10:55
This is a fringe feature, as evidenced by the fact that you
are having a hard time convincing people that it is needed
As with anything that isn't already established and well-known, it's hard
to convince anyone they need anything they don't understand - I think the
barrier here is me having
On 1 May 2013 14:35, Rasmus Schultz ras...@mindplay.dk wrote:
This is a fringe feature, as evidenced by the fact that you
are having a hard time convincing people that it is needed
As with anything that isn't already established and well-known, it's hard
to convince anyone they need
Then why are you not convincing them first to get them on board as support
for your proposal.
It's not a proposal yet - I didn't want to write a lengthy RFC just to
learn that all I had was a brainfart, or that everyone was going to be
totally opposed. Having the discussion here surfaced a
On 1 May 2013 14:55, Rasmus Schultz ras...@mindplay.dk wrote:
Then why are you not convincing them first to get them on board as support
for your proposal.
It's not a proposal yet - I didn't want to write a lengthy RFC just to
learn that all I had was a brainfart, or that everyone was going
: +44 113 812 4730
-Original Message-
From: Rasmus Schultz [mailto:ras...@mindplay.dk]
Sent: 01 May 2013 13:35
To: Rasmus Lerdorf
Cc: Stas Malyshev; PHP internals
Subject: Re: [PHP-DEV] property de-referencing
This is a fringe feature, as evidenced by the fact that you
are having
On Wed, May 1, 2013 at 2:35 PM, Rasmus Schultz ras...@mindplay.dk wrote:
This is a fringe feature, as evidenced by the fact that you
are having a hard time convincing people that it is needed
As with anything that isn't already established and well-known, it's hard
to convince anyone
On May 1, 2013 8:35 AM, Rasmus Schultz ras...@mindplay.dk wrote:
This is a fringe feature, as evidenced by the fact that you
are having a hard time convincing people that it is needed
As with anything that isn't already established and well-known, it's hard
This is like building
The only reason being that the syntax ^$user-name is more static than
new PropertyReference($user, 'name'), and thus easier to refactor?
Not more static, it is static - a string-based property-reference is not.
Refactoring isn't the only benefit - of course most of the benefits are
going to
strings - rather than using native
variable-references as in your example.
---
From: Ford, Mike m.f...@leedsmet.ac.uk
To: PHP internals internals@lists.php.net
Cc:
Date: Wed, 1 May 2013 13:20:32 +
Subject: RE: [PHP-DEV] property de-referencing
I know I'm still somewhat of a beginner with OOP
On Wed, May 1, 2013 at 7:13 PM, Rasmus Schultz ras...@mindplay.dk wrote:
The only reason being that the syntax ^$user-name is more static than
new PropertyReference($user, 'name'), and thus easier to refactor?
Not more static, it is static - a string-based property-reference is not.
I believe you have difficulties explaining these benefits because you
first need to argue why you want reflected properties all over the place.
And once that is established (assuming it is), why you would need dedicated
syntax for it.
I thought that's what I had been doing? Apparently I've just
extend.
-Ursprüngliche Nachricht-
Von: ekne...@gmail.com [mailto:ekne...@gmail.com] Im Auftrag von Etienne
Kneuss
Gesendet: Mittwoch, 1. Mai 2013 22:12
An: Rasmus Schultz
Cc: Rasmus Lerdorf; Stas Malyshev; PHP internals
Betreff: Re: [PHP-DEV] property de-referencing
On Wed, May 1, 2013
On Thu, May 2, 2013 at 2:07 AM, Rasmus Schultz ras...@mindplay.dk wrote:
I believe you have difficulties explaining these benefits because you
first need to argue why you want reflected properties all over the place.
And once that is established (assuming it is), why you would need dedicated
On 30 April 2013 01:45, Rasmus Schultz ras...@mindplay.dk 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
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? What is
2013.04.30. 14:00, Rasmus Schultz ras...@mindplay.dk 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:
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); // =
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)
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
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
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 should be in
2013/4/30 Rasmus Lerdorf ras...@lerdorf.com
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
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
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 work
I suggested something similar earlier:
http://marc.info/?t=13632784962r=1w=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
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,
On 30 April 2013 16:15, Rasmus Schultz ras...@mindplay.dk 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
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
2013/5/1 Rasmus Schultz ras...@mindplay.dk
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;
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 care
On Tue, Apr 30, 2013 at 7:34 PM, Adam Harvey ahar...@php.net 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?
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 not
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
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
Hi Rasmus,
Am 25.04.2013 um 14:47 schrieb Rasmus Schultz ras...@mindplay.dk:
[...]
What do you think?
I'm not sure about the operator character but the general idea is a good one.
Do you have a patch as a POC?
cu,
Lars
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe,
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 Strojny l...@strojny.net wrote:
Hi Rasmus,
Am
On Thu, Apr 25, 2013 at 2:47 PM, Rasmus Schultz ras...@mindplay.dk wrote:
Okay,
No one seemed extremely interested in my notes about static
type-referenceshttp://marc.info/?t=13632784962r=1w=2- I want
to bring up something closely related that could possibly be even
more useful, in
Maybe I didn't understand what you mean, but if you want property
references, why not just use, well, property references?
Property-references don't know what property they're referencing - they
reference the object/value held by the property, not the property itself.
If you want more than
60 matches
Mail list logo