HTML5 allow omitting head, body, html (they had no fundamental differences
in parsing IRL), and also quotes and some end tags. Makes for much, much
nicer HTML, e.g.:

<!doctype html>
<meta charset=utf-8>
<title>hello</title>

<h1>hi</h1>
<ul>
    <li>item 1
    <li>item 2
</ul>

...that's off-topic though. I don't think we should have more tolerance of
omitted braces in PHP. If you desparately want them, write CoffeeScript
except for PHP (RasmusScript?)
On Jul 19, 2012 4:57 PM, "Larry Garfield" <la...@garfieldtech.com> wrote:

> There is no such thing as an optional closing tag or brace.  There's only
> lazy and sloppy coders, and parsers that encourage them.
>
> --Larry Garfield
>
> On 7/19/12 10:52 AM, Andrew Faulds wrote:
>
>> Always close <p>, but never close <li> :)
>> On Jul 19, 2012 4:44 PM, "Larry Garfield" <la...@garfieldtech.com> wrote:
>>
>>  On 7/19/12 5:11 AM, Peter Beverloo wrote:
>>>
>>>   I have seen this problem happen, people losing time trying to figure
>>> out
>>>
>>>> what is wrong only to find
>>>>> its a missing bracket.
>>>>> As Paul said, this is bug-prone.
>>>>>
>>>>>
>>>>>  Other bracket-less blocks allow authors to shoot themselves in the
>>>> foot
>>>> equally so, yet PHP supports these as well. The actual problem here is
>>>> an
>>>> inconsistency in the parser, which I'd consider to be a bug.
>>>>
>>>> Peter
>>>>
>>>>
>>>
>>> PHP doesn't support optional brackets on functions, either; please no one
>>> suggest that.
>>>
>>> Yes, it's inconsistent that some structures allow short-circuited
>>> brackets.  The solution isn't to let all structures have the
>>> bug-attracting
>>> syntax.  If it wouldn't break a few zillion lines of existing code I'd
>>> say
>>> we should resolve the inconsistency by making the braces required on
>>> if/foreach/etc.  PHP only has them optional due to a C/C++ legacy, which
>>> may have made sense when the byte size of source code actually mattered
>>> for
>>> storage efficiency.
>>>
>>> Yes, I have run into bugs that were caused by people forgetting braces.
>>>   Yes, I have introduced bugs without realizing it because someone left
>>> off
>>> a brace and I didn't notice it.  Yes, I now always add braces when
>>> looking
>>> at someone's code; I can't even read it otherwise anymore.  Any
>>> respectable
>>> coding standard requires the otherwise-optional braces.
>>>
>>> And yes, I always close my </p> tags as well, and so should you! :-)
>>>
>>> --Larry Garfield
>>>
>>> --
>>> PHP Internals - PHP Runtime Development Mailing List
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>>
>>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to