Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-24 Thread Crypto Compress
Am 24.01.2013 02:12, schrieb Levi Morrison: I also don't like the `?` for `nullable`. Just stick with PHP convention and do: class Foo { public Bar $bar = NULL; } There is no such PHP convention. The PHP convention is *not restrict type* (+"loosely typed" addons). So N

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Arpad Ray
On Wed, Jan 23, 2013 at 10:35 PM, Clint Priest wrote: > On 1/23/2013 3:17 PM, Levi Morrison wrote: >> Clint: I'm sorry that you spent all that time without hearing feedback >> from a lot of the "No" voters. Had they been participating all along >> perhaps it could have been avoided. We'll never kn

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Levi Morrison
>> I also don't like the `?` for `nullable`. Just stick with PHP >> convention and do: >> >> class Foo { >> public Bar $bar = NULL; >> } > > > There is no such PHP convention. The PHP convention is *not restrict type* > (+"loosely typed" addons). > So NULL is automatically allow

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Crypto Compress
Thank you! Will look at it tomorrow. Am 24.01.2013 00:45, schrieb Clint Priest: On 1/23/2013 5:04 PM, Crypto Compress wrote: guard->in_unset = 1; /* Prevent recursion */ zend_call_method_with_1_params(&object, zobj->ce, &zobj->ce->__unset, ZEND_UNSET_FUNC_NAME, NULL, member); guard->in_unset

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Clint Priest
On 1/23/2013 5:04 PM, Crypto Compress wrote: guard->in_unset = 1; /* Prevent recursion */ zend_call_method_with_1_params(&object, zobj->ce, &zobj->ce->__unset, ZEND_UNSET_FUNC_NAME, NULL, member); guard->in_unset = 0; /* Prevent recursion */ a) That applies to __unset (magic method) only b) g

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Crypto Compress
Hello! 1) not able to vote 2) looked at patch 3) do not understand the patch so i have a question regarding guards... e.g.: guard->in_unset = 1; /* Prevent recursion */ zend_call_method_with_1_params(&object, zobj->ce, &zobj->ce->__unset, ZEND_UNSET_FUNC_NAME, NULL, member); guard->in_unset =

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Clint Priest
On 1/23/2013 4:40 PM, Rasmus Lerdorf wrote: I appreciate that, I'm hearing through the grapevine that some of the "no" voters haven't even looked at the patch. Just to be fair, I suspect quite a few "yes" voters haven't looked at, nor understood the patch. -Rasmus I'd bet good money that's tr

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Rasmus Lerdorf
On 01/23/2013 02:35 PM, Clint Priest wrote: > > On 1/23/2013 3:17 PM, Levi Morrison wrote: >> Clint: I'm sorry that you spent all that time without hearing feedback >> from a lot of the "No" voters. Had they been participating all along >> perhaps it could have been avoided. We'll never know. > >

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Clint Priest
On 1/23/2013 3:17 PM, Levi Morrison wrote: Clint: I'm sorry that you spent all that time without hearing feedback from a lot of the "No" voters. Had they been participating all along perhaps it could have been avoided. We'll never know. I appreciate that, I'm hearing through the grapevine that

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Crypto Compress
Well actually you're right. .3 was written by Dennis long ago and I wrote accessors to be exactly as that document described except where there was ambiguity. @Steve Clay: this would be a perfect point to start with

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Crypto Compress
Hello Levi, Agreed, but if they are automatically generated then I see no harm in allow custom `isset` and `unset` behavior as long as it doesn't get in the way or complicate things. If override of isset/unset is possible, we will end up debugging: true === isset($this->someUninitializedV

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Anthony Ferrara
Levi, et al. > class Foo { > > private $_bar; > > public function get bar { return $this->_bar; } > > public function set bar { $this->_bar = $value; } > > } > class Foo { > private $_bar; > public get bar() { return $this->_bar; } > public set bar($value) { $this

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Levi Morrison
Steve: Like your summary. Disagree with a few points but in general I agree with you. More below. > 2. C# has no issetter/unsetter. > > IMO customizing these functions is completely unneeded for the vast majority > of use cases and could be replaced by simpler logic: isset($this->prop) > calls th

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Clint Priest
On 1/23/2013 3:07 PM, Crypto Compress wrote: > I'd just like to point out the fact that RFC v1.1 from a year ago was exactly as above but people wanted all of these other features. They were not a property, they had no "guarding", no unset, isset, etc. The original RFC that was exactly as c# h

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Crypto Compress
> I'd just like to point out the fact that RFC v1.1 from a year ago was exactly as above but people wanted all of these other features. They were not a property, they had no "guarding", no unset, isset, etc. The original RFC that was exactly as c# had it, nobody liked it. It was changed to its

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Clint Priest
On Jan 23, 2013, at 1:23 PM, Steve Clay wrote: > First of all, I think the functionality provided by Clint and Nikita's RFC > [1] is in demand and would be an asset to PHP, but I also think it can > repackaged more simply. > > People are comparing the RFC to C# [2], but while they look similar

RE: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread nathan
>Personally, I don't see why 'default' can't be used: >class Foo { >public $bar { get; set; default 5; } } > >This solves the var_dump() problem, and if people want dynamic get returning something other than the property/field value, so be it. >C# does indeed have an internal field per propert

Re: [PHP-DEV] C# properties vs. accessors RFC

2013-01-23 Thread Ralph Schindler
Hi Steve, 2. C# has no issetter/unsetter. IMO customizing these functions is completely unneeded for the vast majority of use cases and could be replaced by simpler logic: isset($this->prop) calls the getter and compares to NULL; unset($this->prop) passes NULL to the setter. I tend to agree h