Re: [RFC] Square brackets shortcut

From: Date: Thu, 10 Jan 2008 15:04:17 +0000
Subject: Re: [RFC] Square brackets shortcut
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-34649@lists.php.net to get a copy of this message
On Jan 10, 2008 9:39 AM, Sam Barrow <sam@sambarrow.com> wrote: > On Thu, 2008-01-10 at 14:56 +0100, Hannes Magnusson wrote: > > So you reject scalar type hinting because it isn't type casting and > > can therefor confuses newbies - but scattering seemingly random > > brackets around your code (to safe 5 key strokes) is obvious to users? > > > > Noone would confuse this with named arguments? > > Why can't I do function foo([] $array) {} ? > > > > foo([]); > > $var = []; > > Is this really readable? > > > > Are you really serious about this? > > I don't think the only benefit in this would be to save keystrokes. I > think it looks better, and makes code more readable, whereas the current > way just looks like a function call. Not only do I agree, but I'll also refer anyone wondering how well it would really be adopted due to the initial difficulty in recognizing the structure to the ternary operator. Unless it's an obvious condition and result, ternary operation itself is equally - if not more - trivial to initially figure out than $a = [1,2,3];. -- </Dan> Daniel P. Brown Senior Unix Geek and #1 Rated "Year's Coolest Guy" By Self Since 1979.

« previous php.internals (#34649) next »