Hello Sam,
I think you misunderstand, let me retype for you.
strlen('abstract protected function string dostuff()') < strlen('abstract
protected function dostuff() return string')
Making your argument on length void, also, maybe we should not base a
language change decision on typing extra characters..
Sorry man, but to me the code below looks so unusual for what it is meant to
represent:
abstract protected function bar($foo) return string {
// code
}
The above, actually kind of makes me think something non-conventional is
going to happen like return string specifies that it will be auto type
casted to a string for me or something. like:
abstract protected function bar($foo) return string {
return $foo;
// is auto magically like: return (string) $foo;
}
vs the below code that tells me function returns a string like in many
popular languages.
abstract protected function string bar($foo) {
return (string) $foo;
}
-Chris
On Fri, Apr 25, 2008 at 3:04 PM, Sam Barrow <[EMAIL PROTECTED]> wrote:
> I don't know, maybe it does work. But either way I'm not introducing a
> new keyword, I changed the patch to reuse the return keyword.
>
> Yes, long strings of keywords:
>
> abstract protected string function dostuff()
>
> On Fri, 2008-04-25 at 14:22 -0700, Chris Stockton wrote:
> > On Fri, Apr 25, 2008 at 12:25 PM, Sam Barrow <[EMAIL PROTECTED]>
> > wrote:
> >
> > On Fri, 2008-04-25 at 13:24 -0600, Nathan Nobbe wrote:
> > > On Fri, Apr 25, 2008 at 1:15 PM, Sam Barrow
> > <[EMAIL PROTECTED]> 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.
> >
> > There can be no technical reason why this more adopted and understood
> > syntax should not be possible. Adding returns as a keyword would
> > completely break tons of code. Why are the proposals on something that
> > is so consistent across many languages being changed so obscurely? Why
> > a seperate non-intuitive syntax.
> >
> > public function int (string $foo) { return 1; }
> >
> > Can't we keep the sanity?
> >
> >
> > [ ... ] Plus this leads to
> > long strings of keywords.
> >
> > Are you kidding? strlen('returns int') > strlen('int'); .....
> >
> >
> > -Chris
>
>