FAQ
Hi

Is there any reason for we don't support expressions like:

test() or throw new Exception('test() failed');


If no, is there any argument against supporting such a syntax in trunk?

--
regards,

Kalle Sommer Nielsen
kalle@php.net

Search Discussions

  • Etienne Kneuss at Sep 5, 2010 at 12:30 pm

    On Sep 05 14:19:16, Kalle Sommer Nielsen wrote:
    Hi

    Is there any reason for we don't support expressions like:

    test() or throw new Exception('test() failed');


    If no, is there any argument against supporting such a syntax in trunk?
    Technically, it should be quite easy to have that available, but it
    might become tricky to handle cases like: foo(throw exception()); or
    even "throw throw throw new Foo;" ? :)

    Also, I consider "or die" patterns to be a bad idea, extending it for
    exceptions might make it a tad bit better, but I still find that bad
    because of i.e. non trivial precedence rules:

    include("foo") or throw new Exception("ads");

    it will neither include "foo" nor throw any exception.
    --
    regards,

    Kalle Sommer Nielsen
    kalle@php.net

    --
    PHP Internals - PHP Runtime Development Mailing List
    To unsubscribe, visit: http://www.php.net/unsub.php
    --
    Etienne Kneuss
    http://www.colder.ch

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
categoriesphp
postedSep 5, '10 at 12:19p
activeSep 5, '10 at 12:30p
posts2
users2
websitephp.net

People

Translate

site design / logo © 2022 Grokbase