Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Paul Dragoonis
Why is your try block only going to contain 1 line, and that's
throwing an exception??

try
throw new Exception('foobar');
catch(Exception $e)


Braces are a good thing, they give structure and stop people from
mis-reading things and writing bugs, the same can be said for the if()
situation.

1) Braces are good.
2) Try with only one line in it to throw an exception doesn't seem
like a realistic situation.

-1 from me, sorry Hoa.

On Thu, Jul 19, 2012 at 10:44 AM, Ivan Enderlin @ Hoa
 wrote:
> Hi internals,
>
> As you certainly know, brackets defining blocks in PHP are optional if
> blocks contain a single instruction. Thus:
>
> if($condition) {
> echo 'foobar';
> }
>
> is strictly equivalent to:
>
> if($condition)
> echo 'foobar';
>
> But this syntactic sugar is not applied uniformly to all PHP language
> constructions. I have the try/catch couple in mind.
> First, I would like to know why it is not possible to write:
>
> try
> throw new Exception('foobar');
> catch(Exception $e)
> var_dump($e->getMessage());
>
> as a strict equivalence of:
>
> try {
> throw new Exception('foobar');
> }
> catch(Exception $e) {
> var_dump($e->getMessage());
> }
>
> Second, if it is possible, could we plan to have this “feature” (uniformity
> actually) in PHP6 (or maybe before)?
>
> Best regards.
>
> --
> Ivan Enderlin
> Developer of Hoa
> http://hoa.42/ or http://hoa-project.net/
>
> PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
> http://disc.univ-fcomte.fr/ and http://www.inria.fr/
>
> Member of HTML and WebApps Working Group of W3C
> http://w3.org/
>
>
>
> --
> 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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Alexey Zakhlestin

On 19.07.2012, at 13:49, Paul Dragoonis wrote:

> 2) Try with only one line in it to throw an exception doesn't seem
> like a realistic situation.

It could be something like this:

try
$object->method();
catch (\Exception $e)
return false;


and ->method(), obviously, can have quite a long and complex structure

signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Charlie Somerville

On Thursday, 19 July 2012 at 7:49 PM, Paul Dragoonis wrote:

> Why is your try block only going to contain 1 line, and that's
> throwing an exception??
>  
> try
> throw new Exception('foobar');
> catch(Exception $e)
>  
>  

Because it's a contrived example. He's not trying to write real code, he's 
trying to demonstrate his point - and you totally missed that point.  

> Braces are a good thing, they give structure and stop people from
> mis-reading things and writing bugs, the same can be said for the if()
> situation.
>  
> 1) Braces are good.
This is subjective. There are some cases where it might improve code 
readability to drop the braces for a single-statement try/catch.


There's certainly no technical barrier to doing this. I'm not familiar with 
PHP's parser, but I'd imagine there would be some kind of 'statement' 
non-terminal that would handle single statements as well as a braced group of 
statements.

> 2) Try with only one line in it to throw an exception doesn't seem
> like a realistic situation.
>  
>  

There could be some utility to this. For example, as well as having post-fix 
if, unless, etc., Ruby also has a post-fix 'rescue'. Here's a silly example of 
its use:


some_var = foo.bar rescue "oops"

If 'foo.bar' threw an exception, some_var would contain "oops" instead.

I think PHP could benefit from having a single statement try form. I often turn 
to PHP for quick and dirty scripts when I need to do something with little 
fuss. I think having try/catch support brace-less single statements would help 
increase consistency in PHP's syntax, as well as be useful in certain 
situations.  

On Thursday, 19 July 2012 at 7:49 PM, Paul Dragoonis wrote:

>  
> -1 from me, sorry Hoa.
>  
> On Thu, Jul 19, 2012 at 10:44 AM, Ivan Enderlin @ Hoa
> mailto:ivan.ender...@hoa-project.net)> wrote:
> > Hi internals,
> >  
> > As you certainly know, brackets defining blocks in PHP are optional if
> > blocks contain a single instruction. Thus:
> >  
> > if($condition) {
> > echo 'foobar';
> > }
> >  
> > is strictly equivalent to:
> >  
> > if($condition)
> > echo 'foobar';
> >  
> > But this syntactic sugar is not applied uniformly to all PHP language
> > constructions. I have the try/catch couple in mind.
> > First, I would like to know why it is not possible to write:
> >  
> > try
> > throw new Exception('foobar');
> > catch(Exception $e)
> > var_dump($e->getMessage());
> >  
> > as a strict equivalence of:
> >  
> > try {
> > throw new Exception('foobar');
> > }
> > catch(Exception $e) {
> > var_dump($e->getMessage());
> > }
> >  
> > Second, if it is possible, could we plan to have this “feature” (uniformity
> > actually) in PHP6 (or maybe before)?
> >  
> > Best regards.
> >  
> > --
> > Ivan Enderlin
> > Developer of Hoa
> > http://hoa.42/ or http://hoa-project.net/
> >  
> > PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
> > http://disc.univ-fcomte.fr/ and http://www.inria.fr/
> >  
> > Member of HTML and WebApps Working Group of W3C
> > http://w3.org/
> >  
> >  
> >  
> > --
> > 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
>  
>  




Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Rafael Dohms
On Thu, Jul 19, 2012 at 11:44 AM, Ivan Enderlin @ Hoa <
ivan.ender...@hoa-project.net> wrote:

> Hi internals,
>
> As you certainly know, brackets defining blocks in PHP are optional if
> blocks contain a single instruction. Thus:
>
> if($condition) {
> echo 'foobar';
> }
>
> is strictly equivalent to:
>
> if($condition)
> echo 'foobar';
>
> But this syntactic sugar is not applied uniformly to all PHP language
> constructions. I have the try/catch couple in mind.
>

Writing if blocks without brakets is considered a bad practice. IMHO anyway.


> First, I would like to know why it is not possible to write:
>
> try
> throw new Exception('foobar');
> catch(Exception $e)
> var_dump($e->getMessage());
>
>
This has code readability problem written all over it. When maintaining it
also has problems, like with the bracket-less if's.
You would need to add brackets if you add an extra line here, as well as
you might get unexpected behaviour of you forget to
add brackets in that case.


> as a strict equivalence of:
>
> try {
> throw new Exception('foobar');
> }
> catch(Exception $e) {
> var_dump($e->getMessage());
> }
>
> Second, if it is possible, could we plan to have this “feature”
> (uniformity actually) in PHP6 (or maybe before)?
>
>
Sorry, -1 from me.


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Paul Dragoonis
On Thu, Jul 19, 2012 at 10:58 AM, Charlie Somerville
 wrote:
> On Thursday, 19 July 2012 at 7:49 PM, Paul Dragoonis wrote:
>
> Why is your try block only going to contain 1 line, and that's
> throwing an exception??
>
> try
> throw new Exception('foobar');
> catch(Exception $e)
>
> Because it's a contrived example. He's not trying to write real code, he's
> trying to demonstrate his point - and you totally missed that

You're right, I totally missed that point.

>
> Braces are a good thing, they give structure and stop people from
> mis-reading things and writing bugs, the same can be said for the if()
> situation.
>
> 1) Braces are good.
>
> This is subjective. There are some cases where it might improve code
> readability to drop the braces for a single-statement try/catch.
>
> There's certainly no technical barrier to doing this. I'm not familiar with
> PHP's parser, but I'd imagine there would be some kind of 'statement'
> non-terminal that would handle single statements as well as a braced group
> of statements.

Same sentiments as from Rafael, bracket-less is bug-prone.

>
> 2) Try with only one line in it to throw an exception doesn't seem
> like a realistic situation.
>
> There could be some utility to this. For example, as well as having post-fix
> if, unless, etc., Ruby also has a post-fix 'rescue'. Here's a silly example
> of its use:
>
> some_var = foo.bar rescue "oops"
>
> If 'foo.bar' threw an exception, some_var would contain "oops" instead.
>
> I think PHP could benefit from having a single statement try form. I often
> turn to PHP for quick and dirty scripts when I need to do something with
> little fuss. I think having try/catch support brace-less single statements
> would help increase consistency in PHP's syntax, as well as be useful in
> certain situations.
>
> On Thursday, 19 July 2012 at 7:49 PM, Paul Dragoonis wrote:
>
>
> -1 from me, sorry Hoa.
>
> On Thu, Jul 19, 2012 at 10:44 AM, Ivan Enderlin @ Hoa
>  wrote:
>
> Hi internals,
>
> As you certainly know, brackets defining blocks in PHP are optional if
> blocks contain a single instruction. Thus:
>
> if($condition) {
> echo 'foobar';
> }
>
> is strictly equivalent to:
>
> if($condition)
> echo 'foobar';
>
> But this syntactic sugar is not applied uniformly to all PHP language
> constructions. I have the try/catch couple in mind.
> First, I would like to know why it is not possible to write:
>
> try
> throw new Exception('foobar');
> catch(Exception $e)
> var_dump($e->getMessage());
>
> as a strict equivalence of:
>
> try {
> throw new Exception('foobar');
> }
> catch(Exception $e) {
> var_dump($e->getMessage());
> }
>
> Second, if it is possible, could we plan to have this “feature” (uniformity
> actually) in PHP6 (or maybe before)?
>
> Best regards.
>
> --
> Ivan Enderlin
> Developer of Hoa
> http://hoa.42/ or http://hoa-project.net/
>
> PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
> http://disc.univ-fcomte.fr/ and http://www.inria.fr/
>
> Member of HTML and WebApps Working Group of W3C
> http://w3.org/
>
>
>
> --
> 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
>
>

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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Sebastian Krebs
Hi,

2012/7/19 Paul Dragoonis 

> Why is your try block only going to contain 1 line, and that's
> throwing an exception??
>
> try
> throw new Exception('foobar');
> catch(Exception $e)
>
>
> Braces are a good thing, they give structure and stop people from
> mis-reading things and writing bugs, the same can be said for the if()
> situation.
>
> 1) Braces are good.
> 2) Try with only one line in it to throw an exception doesn't seem
> like a realistic situation.
>

try $this->foobar(); catch ($e) {
// Much amount of error handling
}

// or maybe

try $this->foobar(); catch ($e) $this->handleException($e);

OK, the first example is better, but both reads like quite nice :)

try someVeryDifficultStuff(); catch ($e) { /* handle */ }


Regards,
Sebastian


>
> -1 from me, sorry Hoa.
>
> On Thu, Jul 19, 2012 at 10:44 AM, Ivan Enderlin @ Hoa
>  wrote:
> > Hi internals,
> >
> > As you certainly know, brackets defining blocks in PHP are optional if
> > blocks contain a single instruction. Thus:
> >
> > if($condition) {
> > echo 'foobar';
> > }
> >
> > is strictly equivalent to:
> >
> > if($condition)
> > echo 'foobar';
> >
> > But this syntactic sugar is not applied uniformly to all PHP language
> > constructions. I have the try/catch couple in mind.
> > First, I would like to know why it is not possible to write:
> >
> > try
> > throw new Exception('foobar');
> > catch(Exception $e)
> > var_dump($e->getMessage());
> >
> > as a strict equivalence of:
> >
> > try {
> > throw new Exception('foobar');
> > }
> > catch(Exception $e) {
> > var_dump($e->getMessage());
> > }
> >
> > Second, if it is possible, could we plan to have this “feature”
> (uniformity
> > actually) in PHP6 (or maybe before)?
> >
> > Best regards.
> >
> > --
> > Ivan Enderlin
> > Developer of Hoa
> > http://hoa.42/ or http://hoa-project.net/
> >
> > PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
> > http://disc.univ-fcomte.fr/ and http://www.inria.fr/
> >
> > Member of HTML and WebApps Working Group of W3C
> > http://w3.org/
> >
> >
> >
> > --
> > 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
>
>


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Charlie Somerville
> This has code readability problem written all over it. When maintaining it
> also has problems, like with the bracket-less if's.
> You would need to add brackets if you add an extra line here, as well as
> you might get unexpected behaviour of you forget to
> add brackets in that case.
>  
>  


I've often heard people make this argument, but I've never found it to be a 
real concern in practise.

Is this really such a common problem?  

On Thursday, 19 July 2012 at 8:01 PM, Rafael Dohms wrote:

> On Thu, Jul 19, 2012 at 11:44 AM, Ivan Enderlin @ Hoa <
> ivan.ender...@hoa-project.net (mailto:ivan.ender...@hoa-project.net)> wrote:
>  
> > Hi internals,
> >  
> > As you certainly know, brackets defining blocks in PHP are optional if
> > blocks contain a single instruction. Thus:
> >  
> > if($condition) {
> > echo 'foobar';
> > }
> >  
> > is strictly equivalent to:
> >  
> > if($condition)
> > echo 'foobar';
> >  
> > But this syntactic sugar is not applied uniformly to all PHP language
> > constructions. I have the try/catch couple in mind.
> >  
>  
>  
> Writing if blocks without brakets is considered a bad practice. IMHO anyway.
>  
>  
> > First, I would like to know why it is not possible to write:
> >  
> > try
> > throw new Exception('foobar');
> > catch(Exception $e)
> > var_dump($e->getMessage());
> >  
>  
> This has code readability problem written all over it. When maintaining it
> also has problems, like with the bracket-less if's.
> You would need to add brackets if you add an extra line here, as well as
> you might get unexpected behaviour of you forget to
> add brackets in that case.
>  
>  
> > as a strict equivalence of:
> >  
> > try {
> > throw new Exception('foobar');
> > }
> > catch(Exception $e) {
> > var_dump($e->getMessage());
> > }
> >  
> > Second, if it is possible, could we plan to have this “feature”
> > (uniformity actually) in PHP6 (or maybe before)?
> >  
>  
> Sorry, -1 from me.
>  
>  




Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Rafael Dohms
On Thu, Jul 19, 2012 at 11:58 AM, Charlie Somerville <
char...@charliesomerville.com> wrote:

>
> On Thursday, 19 July 2012 at 7:49 PM, Paul Dragoonis wrote:
>
> > Why is your try block only going to contain 1 line, and that's
> > throwing an exception??
> >
> > try
> > throw new Exception('foobar');
> > catch(Exception $e)
> >
> >
>
> Because it's a contrived example. He's not trying to write real code, he's
> trying to demonstrate his point - and you totally missed that point.
>
>
In this case the removal of brackets would surely limit this to one line,
so any examples or use cases would look the same.


> > Braces are a good thing, they give structure and stop people from
> > mis-reading things and writing bugs, the same can be said for the if()
> > situation.
> >
> > 1) Braces are good.
> This is subjective. There are some cases where it might improve code
> readability to drop the braces for a single-statement try/catch.
>
>
It would cause code maintainability problems and unexpected outputs in
error cases, just like if's do.


>
> There's certainly no technical barrier to doing this. I'm not familiar
> with PHP's parser, but I'd imagine there would be some kind of 'statement'
> non-terminal that would handle single statements as well as a braced group
> of statements.
>
> > 2) Try with only one line in it to throw an exception doesn't seem
> > like a realistic situation.
> >
> >
>
> There could be some utility to this. For example, as well as having
> post-fix if, unless, etc., Ruby also has a post-fix 'rescue'. Here's a
> silly example of its use:
>
>
> some_var = foo.bar rescue "oops"
>
> If 'foo.bar' threw an exception, some_var would contain "oops" instead.
>

a rescue method is a complete other thing, sounds interesting, but has no
reference to bracket-less try blocks.


>
> I think PHP could benefit from having a single statement try form. I often
> turn to PHP for quick and dirty scripts when I need to do something with
> little fuss. I think having try/catch support brace-less single statements
> would help increase consistency in PHP's syntax, as well as be useful in
> certain situations.
>

I think bracket-less is a bad practice that was left for BC, i would rather
we move away from it then move more things into it.

-- 
Rafael Dohms
PHP Evangelist and Community Leader
http://www.rafaeldohms.com.br
http://www.phpsp.org.br


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Rafael Dohms
On Thu, Jul 19, 2012 at 12:03 PM, Charlie Somerville <
char...@charliesomerville.com> wrote:

> This has code readability problem written all over it. When maintaining it
> also has problems, like with the bracket-less if's.
> You would need to add brackets if you add an extra line here, as well as
> you might get unexpected behaviour of you forget to
> add brackets in that case.
>
> I've often heard people make this argument, but I've never found it to be
> a real concern in practise.
>
> Is this really such a common problem?
>

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.
-- 
Rafael Dohms
PHP Evangelist and Community Leader
http://www.rafaeldohms.com.br
http://www.phpsp.org.br


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Peter Beverloo
On Thu, Jul 19, 2012 at 11:06 AM, Rafael Dohms wrote:

> On Thu, Jul 19, 2012 at 12:03 PM, Charlie Somerville <
> char...@charliesomerville.com> wrote:
>
> > This has code readability problem written all over it. When maintaining
> it
> > also has problems, like with the bracket-less if's.
> > You would need to add brackets if you add an extra line here, as well as
> > you might get unexpected behaviour of you forget to
> > add brackets in that case.
> >
> > I've often heard people make this argument, but I've never found it to be
> > a real concern in practise.
> >
> > Is this really such a common problem?
> >
>
> 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


> --
> Rafael Dohms
> PHP Evangelist and Community Leader
> http://www.rafaeldohms.com.br
> http://www.phpsp.org.br
>


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Rune Kaagaard
+1 for the consistency of it. It's surprising that:

if ($foo)
return $bar;
else
return 42;

works and:

try
maybe_dangerous();
catch(Dynamite $e)
handle_error();

does not.

On Thu, Jul 19, 2012 at 12:11 PM, Peter Beverloo  wrote:
> On Thu, Jul 19, 2012 at 11:06 AM, Rafael Dohms 
> wrote:
>
>> On Thu, Jul 19, 2012 at 12:03 PM, Charlie Somerville <
>> char...@charliesomerville.com> wrote:
>>
>> > This has code readability problem written all over it. When maintaining
>> it
>> > also has problems, like with the bracket-less if's.
>> > You would need to add brackets if you add an extra line here, as well as
>> > you might get unexpected behaviour of you forget to
>> > add brackets in that case.
>> >
>> > I've often heard people make this argument, but I've never found it to be
>> > a real concern in practise.
>> >
>> > Is this really such a common problem?
>> >
>>
>> 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
>
>
>> --
>> Rafael Dohms
>> PHP Evangelist and Community Leader
>> http://www.rafaeldohms.com.br
>> http://www.phpsp.org.br
>>

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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Lester Caine

Peter Beverloo wrote:

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.


Having been caught out too many times now when adding an extra part to code 
there 99% of the blocks are correctly wrapped ... when I see code without the 
brackets they get added! The bug as far as I am concerned is NOT reporting them 
missing but just getting them displayed in eclipse would do me for now ;)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk



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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread jevon
This reminds me of
   $var = something or die();

So if you do follow with braceless-try, I would have
   try something() catch($e) do_something_with($e);

Or (a bit simpler, but assumes we have a new pseudovariable $e),
   try something() or do_something_with($e)

I don't like the form with a semicolon, because what if there are two
semi-colons after the statement? What does the try statement wrap?
   try something();; catch ($e) { ... }

The whole concept breaks away from the tradition of wrapping massive
blocks with try { } statements, and might make applications use
exceptions a LOT more freely. Something to keep in mind.

Jevon

On Fri, Jul 20, 2012 at 12:30 AM, Lester Caine  wrote:
> Peter Beverloo wrote:
>>
>> 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.
>
>
> Having been caught out too many times now when adding an extra part to code
> there 99% of the blocks are correctly wrapped ... when I see code without
> the brackets they get added! The bug as far as I am concerned is NOT
> reporting them missing but just getting them displayed in eclipse would do
> me for now ;)
>
> --
> Lester Caine - G8HFL
> -
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk
> Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
>
>
>
>
> --
> 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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Sebastian Krebs
2012/7/19 Rafael Dohms 

> On Thu, Jul 19, 2012 at 12:03 PM, Charlie Somerville <
> char...@charliesomerville.com> wrote:
>
> > This has code readability problem written all over it. When maintaining
> it
> > also has problems, like with the bracket-less if's.
> > You would need to add brackets if you add an extra line here, as well as
> > you might get unexpected behaviour of you forget to
> > add brackets in that case.
> >
> > I've often heard people make this argument, but I've never found it to be
> > a real concern in practise.
> >
> > Is this really such a common problem?
> >
>
> 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.
>

Just curious (once more): How can anyone overlook, that the brackets are
intentionally omitted here?

if ($x) {
// Do something
} else return null;


Of course it's a matter of code style [1], but one can write the ugliest
code with every syntax. This argument about "bug-prone" often confuses me,
because I for myself never had such a problem. I also never knew someone,
who had a problem with bracket-less blocks (but must say, that most write
blocks _with_ brackets, thus they _may_ have problems). I've often just
heard this "its bug-prone" (that sounds to me like "there are inattentive
devs out there" to me :X) as as killer argument...
At the end of the day I don't really care wether I should avoid
bracket-less blocks, or not, but ... it's this argument that annoys me :X
And I just think this just looks cute :)

try $calculator->calculateSomeVeryDifficultStuff() catch ($e) {
  // on failure
}

2cent and so on

Regards,
Sebastian


[1] I would wrap "return null;" in brackets too, if the line gets too long.

if ($x) {
// Do something
} else {
return someVeryLongStatement() && andSuch();
}






> --
> Rafael Dohms
> PHP Evangelist and Community Leader
> http://www.rafaeldohms.com.br
> http://www.phpsp.org.br
>


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Lester Caine

Sebastian Krebs wrote:

Of course it's a matter of code style [1], but one can write the ugliest
code with every syntax. This argument about "bug-prone" often confuses me,
because I for myself never had such a problem. I also never knew someone,
who had a problem with bracket-less blocks (but must say, that most write
blocks_with_  brackets, thus they_may_  have problems). I've often just
heard this "its bug-prone" (that sounds to me like "there are inattentive
devs out there" to me :X) as as killer argument...


10 years in to development work on projects combining library code from many 
sources, The indenting tends to get messed up over time, and it CAN be difficult 
to spot that the brackets are missing from a block. In addition to adding them 
as I spot missing ones, the indentation will also get tidied up to make things 
readable again. The latest injection problem I had reported turned out to be in 
the smarty library. The fix involved tidying the layout just to make sure I was 
in the right place when fixing it. ( 'highlight' would quite happily pass nasty 
code! ) It's all this code, the authors of which have now retired to an easier 
live which we have to maintain going forward :(


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk



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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Cyberspice
Probably not so much in PHP but I've had some real doozers in my time due this.

For example in C...

if (somethingsFailed)
DEBUG_MACRO("Something failed!");

var = 1;

And then someone un-defines DEBUG_MACRO.

Fun then ensues.

Melanie

On 19 Jul 2012, at 11:03, Charlie Somerville wrote:

> 
> 
> I've often heard people make this argument, but I've never found it to be a 
> real concern in practise.
> 
> Is this really such a common problem?  


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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Larry Garfield

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  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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Andrew Faulds
Always close , but never close  :)
On Jul 19, 2012 4:44 PM, "Larry Garfield"  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  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
>
>


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Larry Garfield
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 , but never close  :)
On Jul 19, 2012 4:44 PM, "Larry Garfield"  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  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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Andrew Faulds
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.:



hello

hi

item 1
item 2


...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"  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 , but never close  :)
>> On Jul 19, 2012 4:44 PM, "Larry Garfield"  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  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
>
>


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-19 Thread Sara Golemon
For all the reasons already stated, most explicitly because it make the
code ugly as sin, my vote is somewhere between "No", and "Hell No."

-1 on bracketless try/catch


On Thu, Jul 19, 2012 at 2:44 AM, Ivan Enderlin @ Hoa <
ivan.ender...@hoa-project.net> wrote:

> Hi internals,
>
> As you certainly know, brackets defining blocks in PHP are optional if
> blocks contain a single instruction. Thus:
>
> if($condition) {
> echo 'foobar';
> }
>
> is strictly equivalent to:
>
> if($condition)
> echo 'foobar';
>
> But this syntactic sugar is not applied uniformly to all PHP language
> constructions. I have the try/catch couple in mind.
> First, I would like to know why it is not possible to write:
>
> try
> throw new Exception('foobar');
> catch(Exception $e)
> var_dump($e->getMessage());
>
> as a strict equivalence of:
>
> try {
> throw new Exception('foobar');
> }
> catch(Exception $e) {
> var_dump($e->getMessage());
> }
>
> Second, if it is possible, could we plan to have this “feature”
> (uniformity actually) in PHP6 (or maybe before)?
>
> Best regards.
>
> --
> Ivan Enderlin
> Developer of Hoa
> http://hoa.42/ or http://hoa-project.net/
>
> PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
> http://disc.univ-fcomte.fr/ and http://www.inria.fr/
>
> Member of HTML and WebApps Working Group of W3C
> http://w3.org/
>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-20 Thread Lester Caine

Ivan Enderlin @ Hoa wrote:

Finally, I would like to clarify my proposal: I just wanted to discuss about
making try/catch braces optional and not criticize PHP syntax…


The problem here is rather, could we make brackets compulsory everywhere? No 
because of BC problems, but this might be the preferred approach by many. So 
adding another possible bug creating area does not seem appropriate?


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk



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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-20 Thread Ivan Enderlin @ Hoa

On 20/07/12 11:28, Lester Caine wrote:

Ivan Enderlin @ Hoa wrote:
Finally, I would like to clarify my proposal: I just wanted to 
discuss about

making try/catch braces optional and not criticize PHP syntax…


The problem here is rather, could we make brackets compulsory 
everywhere? No because of BC problems, but this might be the preferred 
approach by many. So adding another possible bug creating area does 
not seem appropriate?
Not everywhere :-). All I have pointed out here is adding consistency to 
control structures, because they are the only language constructions 
impacted by optional brackets.
I very well understand that spreading optional brackets to the entire 
langage is not a good idea. I have never mentioned this possibility.


Cheers.

--
Ivan Enderlin
Developer of Hoa
http://hoa.42/ or http://hoa-project.net/

PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
http://disc.univ-fcomte.fr/ and http://www.inria.fr/

Member of HTML and WebApps Working Group of W3C
http://w3.org/



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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-20 Thread Alexey Zakhlestin

On 20.07.2012, at 12:33, Ivan Enderlin @ Hoa wrote:

> Making braces optional for try/catch does:
> + not break backward compatibility;
> + add consistency in the PHP syntax;
> ± offer a new way to write buggy programs but no more than with other control 
> structures (think about goto ;-)).
> 
> I see more + than - here. Am I wrong?

You are not wrong. This is the inconsistency and it makes sense to fix it.
We are definitely not going to "unfix" it for if/else, so I "+1" your proposal 
in advance


> Moreover, in parallel, a new idea has been landing: introducing the “rescue” 
> keyword as a shortcut/replacement of try/catch, such as:
> $foo = callThatCouldThrow() rescue 'oof';
> Is it possible to chain it, such as:
> $foo = callThatCouldThrow() rescue anotherCallThatCouldThrow() rescue 'oof?';
> 
> Maybe we should start another topic because it could be a nice idea.

I don't see value in this. "finally" would be much more valuable.

try {
doSomething();
} catch (\Exception $e) {
handleException();
} finally {
genericCleanup() // called if everything is good, if everything is bad or 
even if exception is rethrown
}

signature.asc
Description: Message signed with OpenPGP using GPGMail


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-20 Thread Florian Anderiasch
On 07/20/2012 11:37 AM, Ivan P @ Hoa wrote:
> On 20/07/12 11:28, Lester Caine wrote:
>> Ivan Enderlin @ Hoa wrote:
>>> Finally, I would like to clarify my proposal: I just wanted to
>>> discuss about
>>> making try/catch braces optional and not criticize PHP syntax…

I don't see how making something worse because of consistency has any
real benefit besides attacking a perceived problem of inconsistency.

This might be me (quick poll on developers with sample size: 1), but in
all the years of doing PHP/Java/x I hadn't even thought once of trying
to use try/catch without braces. I can't even remember using if without
braces.

Greetings,
Florian

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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-20 Thread Alex Aulbach
Hi Ivan,

> try
> throw new Exception('foobar');
> catch(Exception $e)
> var_dump($e->getMessage());

If you use try/catch that much, that you begin to think about the
syntax, you have an architecture- or design-problem.

PS: And if without brackets should be forbidden.

-- 
Alex Aulbach

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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-20 Thread Léo Peltier

> If you use try/catch that much, that you begin to think about the
> syntax, you have an architecture- or design-problem.

"Easier to ask for forgiveness than permission."
That's one thing I like about python: exceptions everywhere. Much cleaner than 
having to use empty/isset/*_exists all the time.


> PS: And if without brackets should be forbidden.
Enforcing coding style should be forbidden.
I never use brackets with 'if' if I don't have to because _I_ find it more 
readable, but I would never think about changing the language to make everyone 
use what I use (especially for such a trivial thing).


--
Léo Peltier

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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-20 Thread Ivan Enderlin @ Hoa

On 20/07/12 15:32, Alex Aulbach wrote:

Hi Ivan,


try
throw new Exception('foobar');
catch(Exception $e)
var_dump($e->getMessage());

If you use try/catch that much, that you begin to think about the
syntax, you have an architecture- or design-problem.
Not sure about that. First, it was an example. Second, it happens more 
often than you think. For example, if you're writing a dispatcher (i.e. 
redirect some data to some callables), you will want to catch exception 
as early as possible. This is not an architecture- or design-issue, this 
happens sometimes when you code.


And I would like to point that this is not the topic. The topic is 
consistency in PHP syntax (restricted to control structures and 
brackets/braces).


Best regards.

--
Ivan Enderlin
Developer of Hoa
http://hoa.42/ or http://hoa-project.net/

PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
http://disc.univ-fcomte.fr/ and http://www.inria.fr/

Member of HTML and WebApps Working Group of W3C
http://w3.org/


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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-20 Thread Amaury Bouchard
2012/7/20 Alex Aulbach 

> PS: And if without brackets should be forbidden.
>

If I wanted a coding style-constrained language, I would use Python.


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-20 Thread Rafael Dohms
On Fri, Jul 20, 2012 at 3:51 PM, Léo Peltier  wrote:

>
> Enforcing coding style should be forbidden.
>


Clearly you don't work in a team or contribute to Open Source projects.
That's what coding styles are for, keeping code looking the same to make
readability easier for not-you developers.

-- 
Rafael Dohms
PHP Evangelist and Community Leader
http://www.rafaeldohms.com.br
http://www.phpsp.org.br


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-20 Thread Rick WIdmer

On 7/20/2012 7:51 AM, Léo Peltier wrote:
>

Enforcing coding style should be forbidden.


YES!!   I just thought that needed to be repeated!


 On Fri, Jul 20, 2012 at 3:51 PM, Léo Peltier  
wrote:


Clearly you don't work in a team or contribute to Open Source projects.
That's what coding styles are for, keeping code looking the same to make
readability easier for not-you developers.


Your team is welcome to set any standards it wants. On itself.  I don't 
believe you should change the language to enforce those standards on the 
rest of the world!


Rick


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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-20 Thread Levi Morrison
On Fri, Jul 20, 2012 at 1:09 PM, Rick WIdmer  wrote:
> On 7/20/2012 7:51 AM, Léo Peltier wrote:
>>
>>
>> Enforcing coding style should be forbidden.
>
>
> YES!!   I just thought that needed to be repeated!
>
>
>
>  On Fri, Jul 20, 2012 at 3:51 PM, Léo Peltier 
> wrote:
>>
>>
>> Clearly you don't work in a team or contribute to Open Source projects.
>> That's what coding styles are for, keeping code looking the same to make
>> readability easier for not-you developers.
>
>
> Your team is welcome to set any standards it wants. On itself.  I don't
> believe you should change the language to enforce those standards on the
> rest of the world!
>
> Rick
>
>

You should ask the Python people about that . . . :)

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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-20 Thread Andrew Faulds
Python isn't coding-style constrained, it just uses increases and decreases
whitespace as part of the block syntax. It has considerable flexibility,
but not PHP/Perl-level.
On Jul 20, 2012 3:33 PM, "Amaury Bouchard"  wrote:

> 2012/7/20 Alex Aulbach 
>
> > PS: And if without brackets should be forbidden.
> >
>
> If I wanted a coding style-constrained language, I would use Python.
>


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-22 Thread Alex Aulbach
2012/7/20 Ivan Enderlin @ Hoa :
> On 20/07/12 15:32, Alex Aulbach wrote:
>> If you use try/catch that much, that you begin to think about the
>> syntax, you have an architecture- or design-problem.
>
> Not sure about that. First, it was an example. Second, it happens more often
> than you think. For example, if you're writing a dispatcher (i.e. redirect
> some data to some callables), you will want to catch exception as early as
> possible.

And you misunderstood me: My first thought of removing bracelets was,
that someone could need this, because he has hundreds of
try/catch-blocks and just want to spare some typing.

My thinking is: If someone needs that much try/catch that he begins to
think about syntax, he has definitely another problem
(architecture/design).

>This is not an architecture- or design-issue, this happens
> sometimes when you code.

It's always so, but it's not a reason for another syntax. :)


> And I would like to point that this is not the topic. The topic is
> consistency in PHP syntax (restricted to control structures and
> brackets/braces).

No, that's exactly the point. :) The reason why we have different
syntaxes is, that it was introduced in PHP/FI, about 16 yreas ago. I
cannot remember the exact timings, but Rasmus experimented a lot with
the syntax and everybody was glad, when the C-syntax has been
implemented - but the old syntax-stuff remained and was quite buggy
and very obfuscating. This was fixed with PHP3. That's why we have
syntaxes without bracelets, everybody liked it, because we could say
"haha, you perl-guys, you C-junkies, we've more ways to program an
if".

That's about 16 (?) year ago and perhaps I mixed it a lttle bit up.
But nowadays it's no question, that brackets are good. But at that
time continental-European programmers tend not using bracelets,
because they are so difficult to type. :)

In other words: You want to introduce something, which we are glad not
to need anymore. :)

-- 
Alex Aulbach

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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-23 Thread Ivan Enderlin @ Hoa


On 23/07/12 06:03, Alex Aulbach wrote:

In other words: You want to introduce something, which we are glad not
to need anymore. :)

Ok. And as I said, it is a proposal so… ;-).

Next topic: rescue or finally keywoard?

Best regards :-).

--
Ivan Enderlin
Developer of Hoa
http://hoa.42/ or http://hoa-project.net/

PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
http://disc.univ-fcomte.fr/ and http://www.inria.fr/

Member of HTML and WebApps Working Group of W3C
http://w3.org/



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



Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-23 Thread Charlie Somerville
rescue is the exact same concept as catch

On Jul 24, 2012 3:41 PM, "Ivan Enderlin @ Hoa" <
ivan.ender...@hoa-project.net> wrote:
>
>
> On 23/07/12 06:03, Alex Aulbach wrote:
>>
>> In other words: You want to introduce something, which we are glad not
>> to need anymore. :)
>
> Ok. And as I said, it is a proposal so… ;-).
>
> Next topic: rescue or finally keywoard?
>
> Best regards :-).
>
>
> --
> Ivan Enderlin
> Developer of Hoa
> http://hoa.42/ or http://hoa-project.net/
>
> PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis)
> http://disc.univ-fcomte.fr/ and http://www.inria.fr/
>
> Member of HTML and WebApps Working Group of W3C
> http://w3.org/
>
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>


Re: [PHP-DEV] Make try/catch brackets optinal

2012-07-23 Thread Ferenc Kovacs
2012.07.24. 7:41, "Ivan Enderlin @ Hoa"  ezt
írta:
>
>
> On 23/07/12 06:03, Alex Aulbach wrote:
>>
>> In other words: You want to introduce something, which we are glad not
>> to need anymore. :)
>
> Ok. And as I said, it is a proposal so… ;-).
>
> Next topic: rescue or finally keywoard?
>

For finally see https://bugs.php.net/bug.php?id=32100

it seems that the core devs don't like the idea, but that feature request
seems to have a lot of supporters, and comes up frequently.