5 ms·
This feels like a giant step towards the past.
by jnorthrop 17y ago
This feels like a giant step towards the past.
- ComputerGuru 17y agoThis is a giant step towards the past. Welcome to 1980.
- deleted 17y ago[deleted]
- encoderer 17y agowhile() loops are just goto's with some syntactic sugar..
- jcsalterego 17y agoWhile loops are restricted gotos with syntactic sugar.
- ComputerGuru 17y agoNow that I come to think of it, it actually doesn't matter for PHP. While loops limit the scope of variables inside the loop. For C++, that means a variable declared inside cannot be used outside - logical, and OOP. But PHP has no concept of privacy or scope, even its "rules" may be broken (though not guaranteed to always work) and come out with the right results. Anything will compile, and usually the results are as expected. So if you have a while loop with no concept of scope or local variables, I guess the restrictions are gone. A number of nested loops with breaks; and continues; all over end so long as the concept of limited data scope/access is not present as in PHP are exactly equivalent to goto as it is. I guess a language as, shall we say, 'relaxed' as PHP is well-matched with relaxed keywords like goto.
- pbiggar 17y agoNo, thats not what he means. He means that gotos are unstructured, and you can do anything with them, like jumping into a loop. Although, PHP's gotos don't allow they, and PHP still only admits structured control flow.
- antidaily 17y ago10 PRINT "WELCOME TO 1980" 20 GOTO 10
- zkz 17y agoRather goto 1980
- kaiuhl 17y agoUsing PHP is a giant step towards the past. PHP will never fully be utilized as an OO language by the vast majority of its user base due to its syntactically terrible standard library and history as a functional language. As such, this addition makes plenty of sense.
- youngian 17y agoFunctional language? Did you mean to say procedural language? I can assure you that PHP is not a functional language (despite all my efforts to make it one).
- noodle 17y ago1) its only a step backwards if you're currently using a better language. its a step forward for other people who are way behind, or for people who have no web development experience and want to get started. it a decent and very popular learning language. if someone starts writing about goto in their php tutorials for beginners, we'll have a problem. 2) php is procedural, not functional. (edit: whoops, beaten to this punch)
- ars 17y agoPHP will never fully be utilized as an OO language because it's a stupid idea to write web pages with an OO language. Web pages are just not suited to OO. Encapsulation can be done via functions - adding OO to it gets you nothing except longer code. Making things more complicated does not make them better.
- randallsquared 17y agoI almost agree with this. I'm experimenting with Kohana for my latest code, and even though this is supposed to be the lean, fast OO framework, there's a LOT of boilerplate associated. Less than a third of my code is actually get-things-done code, as opposed to more than two thirds last time I was using a home-grown, not-especially-OO framework. Maybe some other framework does this better, though.