On Wed, Oct 10, 2012 at 7:37 PM, Jim Giner <jim.gi...@albanyhandball.com> wrote:
> On 10/10/2012 4:27 PM, Matijn Woudt wrote:
>>
>> On Wed, Oct 10, 2012 at 10:26 PM, Ashley Sheridan
>> <a...@ashleysheridan.co.uk> wrote:
>>>
>>> On Wed, 2012-10-10 at 14:53 -0400, David McGlone wrote:
>>>
>>>> On Wednesday, October 10, 2012 07:36:00 PM Tim Streater wrote:
>>>>>
>>>>> On 10 Oct 2012 at 19:17, David McGlone <da...@dmcentral.net> wrote:
>>>>>
>>>>>
>>>>>>>
>>>>>>>
>>>>>>> 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
>>>>>> I
>>>>
>>>>   don't recall if it used return.
>>>>>
>>>>>
>>>>>
>>>>> Mmmm. 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.
>>>>
>>>>
>>>
>>>
>>> I think most people do, all but BASIC purists!
>>>
>>
>> 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.
>
>

It's the whence command that will get you every time (aka "comesfrom").

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to