Hello, On Sat, Oct 17, 2009 at 4:22 PM, Rune Kaagaard <rumi...@gmail.com> 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/scripts/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: > > <?php > function foo() { > $x = 2; > $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 > > -- Etienne Kneuss http://www.colder.ch -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php