Re: [RFC] Return Type Declarations

From: Date: Wed, 07 May 2014 17:34:50 +0000
Subject: Re: [RFC] Return Type Declarations
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-74023@lists.php.net to get a copy of this message
On 7 May 2014, at 18:02, Lin Yo-An <cornelius.howl@gmail.com> wrote:
> Why using an additional ":" symbol for the return type? what about
> considering this:
> 
>  function foo() string {  }
> 
> and for closure:
> 
>  $bar = 1;
>  $foo = function() use ($bar) string {
> 
>  };
> 
> I think removing ":" symbol is cleaner.

Presumably it’s because TypeScript, ActionScript and Hack already use the function foo() :
type form, so it’s a familiar syntax. However, Go uses the func foobar() type
form, so there’s also precedent for that one. Considering the audience of PHP, TypeScript,
ActionScript and Hack are probably more familiar than Go.

Maybe there’s a technical reason for it, though.
--
Andrea Faulds
http://ajf.me/






Thread (28 messages)

« previous php.internals (#74023) next »