Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37238 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72883 invoked from network); 25 Apr 2008 21:23:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Apr 2008 21:23:32 -0000 Authentication-Results: pb1.pair.com header.from=michal.dziemianko@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=michal.dziemianko@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.182.186 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: michal.dziemianko@gmail.com X-Host-Fingerprint: 64.233.182.186 nf-out-0910.google.com Received: from [64.233.182.186] ([64.233.182.186:3959] helo=nf-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 10/45-18287-4DB42184 for ; Fri, 25 Apr 2008 17:23:32 -0400 Received: by nf-out-0910.google.com with SMTP id e27so1415745nfd.13 for ; Fri, 25 Apr 2008 14:23:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer; bh=E8qx3fp+7Lr1oRRg6PtWj9J4fRsl4kU8ptr8BpnicGY=; b=KU0AhBHrH/LtMFZrFjYpK/XlTug8qnOGgoYoH8Bqcy8QSt4K3hPsGmxX5IhcqiskG0oXJmZHVF7IeCDNX/wektkcVzEd5pqNs7ZrpuALS535v2jnAG449PhriIAFjx7f46OLoHOL0JgVueJPZoqae+Ls4ZnMxu3ZtpVnSYRXv7g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer; b=QWRc/hnR20/fhFmeV/9sc2H4mfgJfR/izfGDC2SK/+XDdz8PcZlIkSNyKMY6+2zVrVUxFWdK/TVThhe8vt63a6v7HVtfmNzzDm5EfbI7PHFkd6jnqdaHl+iaxrzB9VabhvIhujcBbpaH5JHltufi6v7g96Ykcg3+yEv5XbK8QlA= Received: by 10.210.113.16 with SMTP id l16mr2955101ebc.157.1209158609475; Fri, 25 Apr 2008 14:23:29 -0700 (PDT) Received: from ?10.16.0.76? ( [194.81.254.137]) by mx.google.com with ESMTPS id f8sm3551257nfh.13.2008.04.25.14.23.27 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 25 Apr 2008 14:23:28 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v753) In-Reply-To: <1209151505.20639.25.camel@sbarrow-desktop> References: <1209137410.6642.9.camel@sbarrow-desktop> <1209147362.20639.7.camel@sbarrow-desktop> <20080425182341.GB14490@mint.phcomp.co.uk> <1209149047.20639.18.camel@sbarrow-desktop> <48122C14.7070705@omegavortex.net> <1209150944.20639.24.camel@sbarrow-desktop> <7dd2dc0b0804251224s750679acn169637efbd8653fa@mail.gmail.com> <1209151505.20639.25.camel@sbarrow-desktop> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-ID: Content-Transfer-Encoding: 7bit Date: Fri, 25 Apr 2008 22:19:25 +0100 To: internals@lists.php.net X-Mailer: Apple Mail (2.753) Subject: Re: [PHP-DEV] Return type hinting patch From: michal.dziemianko@gmail.com (Michal Dziemianko) Hello everybody, I am new here (just reading for last couple of days), so firstly nice to meet you:) This discussion seems quite interesting for me and it would be nice if I can join... Sam Barrow napisal: >> >> 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). Parser should be able to handle it if the grammar is correct. "something something2 somethign3 int foo(...)" works fine in some languages. LALR parser (Bison is used, isn't it?) is probably the most powerful parser practically used, and certainly can handle such a set of keywords correctly - even without "function" keyword (that makes parsing way easier) - or maybe I have missed some piece of syntax that might cause the problem (then my apologies) As there is a person working on converting parser to Lemon, maybe it would be wise to talk with him (her?), so the grammar is cleaned to handle it. > Plus this leads to > long strings of keywords. imho it is shorter - one keyword less. Actually it is also less confusing for me - maybe because I am using C/C++ and Java a lot where the syntax is equivalent. And if syntax is strict - i.e. modifiers first, then returned type - is quite well-readable - name of the function in the end, returned type just before. The version with "returns" seems to me like "throws" phrase from e.g. Java. Btw there was already such a solution in Pascal, but instead of "returns" colon was used: function foo(...):integer begin ... end Cheers, Michal Dziemianko PS. The idea is great anyways - I was always thinking why it is not implemented:))