Re: [RFC] Alternative typehinting syntax for accessors

From: Date: Thu, 10 Jan 2013 22:11:40 +0000
Subject: Re: [RFC] Alternative typehinting syntax for accessors
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-64830@lists.php.net to get a copy of this message
Hi! The proposal is pretty clear, but could you explain this part: The current accessors proposal will need special handling of the typehint in any case (it can't be handled as a normal method typehint). What special handling is required? > One question that still needs to be discussed is what syntax regarding > parentheses we want to use if this makes it. Currently both set { } and > set($foo) { } style accessors are supported. Do we want to keep those two > with the new syntax? Within this context, I'd prefer getting rid of set {} and only have set($param) {}. You don't save that much typing and you do it at the cost of additional obscurity and complexity - now every developer and every tool that deals with it needs to remember there's hidden $value parameter. IMHO not worth it. I can see what "get;" gives you - you can say "just do the natural thing". But if you start writing code anyway - i.e. if you do {} - then I think it should look like a real function. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227

« previous php.internals (#64830) next »