Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45837 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 72190 invoked from network); 17 Oct 2009 17:38:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Oct 2009 17:38:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 72.14.220.158 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 72.14.220.158 fg-out-1718.google.com Received: from [72.14.220.158] ([72.14.220.158:64190] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 37/B3-11886-A210ADA4 for ; Sat, 17 Oct 2009 13:38:51 -0400 Received: by fg-out-1718.google.com with SMTP id d23so1337642fga.11 for ; Sat, 17 Oct 2009 10:38:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=DB0v++OZEVBP61aLAr3ajE10XThjJXSVGHDPX94toOQ=; b=EA6YBYym4uXe7wKU6NgWKCICwGfJP/YsEO33tiqtriKot3Y19UemdDve8sPLJpnxRA DJGezdje3C51xU9NDIYR4g9HAFrcLHiv5ndQ+BkxKumOujM5UbVCQ3Nz0I7CiuZBVFP0 Lvz97VjXHKTEjWLwwgwN30HkhicpkdGOoONnI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=gKdEBgb3H17zcQk6Tym5KiyWwjJxPYhoU81w2tb+vQD92bbQzFkr8WEiwf9Dy61N/D RtFaXQT2nK1q97+HbUcSDaYhVplKKpulcj9odQ7owdcRAtCEeIMo1bDSqbLyDarXNZ/D Y6KsW2HCb4RP8pUxvkTQfne+PpjipkoL1/oUs= MIME-Version: 1.0 Sender: ekneuss@gmail.com Received: by 10.86.211.38 with SMTP id j38mr2051361fgg.26.1255801127479; Sat, 17 Oct 2009 10:38:47 -0700 (PDT) In-Reply-To: <9db916bc0910170722n97543eflc8951ed7cd8b1db7@mail.gmail.com> References: <9db916bc0910101434x507e05b9r2651eaa67f833164@mail.gmail.com> <9db916bc0910140415h6bb58bd6v1ed35859d2d9a3b0@mail.gmail.com> <9db916bc0910170722n97543eflc8951ed7cd8b1db7@mail.gmail.com> Date: Sat, 17 Oct 2009 19:38:47 +0200 X-Google-Sender-Auth: 849b8426831bbd4c Message-ID: To: Rune Kaagaard Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: Creating an experimental syntax From: colder@php.net (Etienne Kneuss) Hello, On Sat, Oct 17, 2009 at 4:22 PM, Rune Kaagaard wrote: > Dear Internals > > So I'm making good progress and found out that making simple syntax > changes is quite easy. What I currently got working can be seen here: > http://code.google.com/p/php-alternative-syntax/source/browse/trunk/scrip= ts/kitchensink.php. > > However, making functionality changes still baffles me. I changed the > "return" keyword to "<-", and I would like to automatically add a > return on the last line of a function. So that the following PHP code: > > function foo() { > =A0$x =3D 2; > =A0$x * 2; > } > ?> > > would return an int with a value of 4. > > How should I attack this problem? This will be tricky to implement as you've to check if the last statement of the function represents a value or not as Scala does, and a lot of statements in PHP have no values: switch/while/for/if... So function a() { if(true) .. else ..; } would have to implicitely return null, since if() is not a value. > > Thx a lot! > Rune Kaagaard > Denmark > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Etienne Kneuss http://www.colder.ch