(practically, more or less). The tilde conveys that
semantic very well.
* As you mentioned, brackets are (IMO too) close to generics.
Cheers,
Bernhard
--
Bernhard Schussek
Blog: http://webmozarts.com
Twitter: http://twitter.com/webmozart
2013/6/25 Anthony Ferrara ircmax...@gmail.com
Hey all,
I want
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
2013/1/5 Nikita Popov nikita@gmail.com
I think that's a very interesting question, thanks for bringing it up. I
think a good approach here would be the same one used for function argument
typehints, i.e. allow NULL when NULL is specified as the default value. So
`public DateTime $date;`
Hi Clint,
1) Point taken.
2) The use case can be solved with an object implementing ArrayAccess,
but not pragmatically, because then you need a class for *each*
bidirectional association. Let me give a short example:
Given the class Article with a bidirectional many-to-one relation to
Category
Hi Clint,
I would like to urge you again to consider implementing the array
access methods. Without that, this very neat feature becomes
essentially unusable for modelling one-to-many, many-to-one and
many-to-many object relations, as I tried to explain in the previous
topic.
Objects and
Hi Clint,
In order to achieve read-only and write-only, we could do something
similar to this:
/* Explicitly read-only, sub-classes may redefine the getter but may
not define a setter */
public $Hours {
get() { ... }
final private set() {}
}
This would make the additional keyword
2012/10/10 Clint Priest cpri...@zerocue.com:
While I agree it would be a nice to have it would also be un-necessary.
There are already ways to do precisely what is desired here by way of
ArrayAccess.
class Addresses implements ArrayAccess {
offsetSet($offset, $value) { ... }
I too don't think that a new keyword is necessary for this case. Let's
not forget that it is a common practice to document functions with doc
blocks, which further helps understanding what it does.
/**
* @return Generator
* @yield string
*/
function generate() {
...
yield $foo;
...
}
Hi all,
Has array access been considered for properties? I can see a good use
for this for cross-referencing objects.
class Parent
{
private $_children = array();
public $children {
offsetSet { $value-parent = $this; $this-_children[$key] = $value; }
offsetUnset {