[Info-vax] Fortran

Arne Vajhøj arne at vajhoej.dk
Thu Dec 6 20:46:48 EST 2018


On 12/6/2018 8:34 PM, Bill Gunshannon wrote:
> On 12/6/18 8:26 PM, Arne Vajhøj wrote:
>> On 12/6/2018 8:14 PM, Bill Gunshannon wrote:
>>> In my 40 years of doing C I have never seen C as bad as
>>> most of the PHP I have seen outside of the Obfuscated
>>> C Contest.  And even much of that was more understandable.
>>>
>>> I have seen PHP that was so confusing that after being away
>>> from it for three years the original author couldn't figure
>>> it out, or fix it.
>>
>> Weird.
>>
>> PHP is a rather simple language.
>>
>> Usually very straight forward to see what it does. At least
>> if one has seen a "C family" language before.
>>
>> There are a lot of bad PHP code violating all sorts of
>> best practices for design. But it is still readable.
>>
>> A piece of trivial PHP code:
>>
>> <?php
>> function fac($n) {
>>      if($n <= 1) {
>>          return 1;
>>      } else {
>>          return $n * fac($n - 1);
>>      }
>> }
>>
>> for($i = 0; $i <= 10; $i++) {
>>      echo sprintf("fac(%d) = %d\r\n", $i, fac($i));
>> }
>> ?>
>>
>> Most programmers should find that very simple.
> 
> And, as a trivial piece of code, it really does nothing.
> That's easy to understand.  But, as soon as it gets complex
> enough to do anything the fun begins.

What fun?

What constructs in PHP are making it difficult to read?

The above code is unrealistic short.

But most real world PHP code even though longer use very
few language constructs. Often it is just function, if,
for loop, foreach loop and a few PHP functions that are
often very C inspired.

Arne






More information about the Info-vax mailing list