Re: Re: limiting
| From: | Jim Giner | Date: | Thu, 11 Oct 2012 00:37:39 +0000 |
| Subject: | Re: Re: limiting | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-319418@lists.php.net to get a copy of this message | ||
On 10/10/2012 4:27 PM, Matijn Woudt wrote:
On Wed, Oct 10, 2012 at 10:26 PM, Ashley Sheridan <ash@ashleysheridan.co.uk> wrote:On Wed, 2012-10-10 at 14:53 -0400, David McGlone wrote:Not really, goto can safe you a mess. In some situations it's much easier and cleaner to use something like goto cleanup; at each error case, instead of duplicating the cleanup code all over again (Closing sockets, or in languages like C, freeing memory). - Matijn haven't used a goto or go in 30 years.On Wednesday, October 10, 2012 07:36:00 PM Tim Streater wrote:I think most people do, all but BASIC purists!On 10 Oct 2012 at 19:17, David McGlone <david@dmcentral.net> wrote:don't recall if it used return.BTW - in any of your other computer languages didn't they utilize a 'return' statement? PHP's is no different.back in like '85, I learned Pascal that's the only language I learned and IMmmm. There's the problem. Pascal doesn't *have* a return statement. In Pascal, implicitly, you return when execution reaches the end of a function. In fact the same is true of PHP and JavaScript, but in those languages you can return early just by saying return.IMO, this is a major limitation of Pascal. I use returns wherever I feel like it - if I detect there's nothing more for the function to do, I return. Purists object to this; they say you should enter a function at one place and leave at one place. Well, that's a point of view. But more often that not it just leads to convoluted code in order to achieve that. The one time I *had* to use Pascal as that was the only option, I simply put a 999: label at the end of the function and did goto 999 wherever I wanted to do a return. Simples!goto was the thing that got on my nerves. Even to this day I hate that word with a passion.