Re: Return type hinting patch
| From: | Sam Barrow | Date: | Fri, 25 Apr 2008 19:25:05 +0000 |
| Subject: | Re: Return type hinting patch | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-37236@lists.php.net to get a copy of this message | ||
On Fri, 2008-04-25 at 13:24 -0600, Nathan Nobbe wrote:
> On Fri, Apr 25, 2008 at 1:15 PM, Sam Barrow <sam@sambarrow.com> wrote:
> On Fri, 2008-04-25 at 14:08 -0500, Jeremy Privett wrote:
> > Sam Barrow wrote:
> > > I figured it out, the syntax is now as follows:
> > >
> > > function a($b, $c) returns d {
> > > }
> > >
> > > I'll post an update soon.
> > >
> > >
> > >
> >
> > That's certainly a non-intuitive syntax. How about we take a
> page out of
> > the book of other C-style languages before trying to invent
> something
> > else? I agree with Stas, "return" and "returns" are not part
> of a
> > function definition.
>
>
> I don't think it's non-intuitive at all, and even so, it's the
> most intuitive we have. This ordering makes more sense to me
> at first glance (in the order I would think about things;
> scope, name, arguments, return).
>
> im not sure the following has been explicitly proposed, but how about
> omitting the 'return' keyword and placing the return type hint before
> the function identifier
>
> function int a($b, $c) {}
>
This is, but I don't think this is possible, due to confusion with the
keywords (public, private, static, abstract, etc). Plus this leads to
long strings of keywords.
> i think that is most congruent with 'typical' of c style languages,
> no ?
>
> -nathan
>
>