[Info-vax] OS implementation languages

Dave Froble davef at tsoft-inc.com
Sat Sep 9 16:19:33 EDT 2023


On 9/9/2023 10:10 AM, Arne Vajhøj wrote:
> On 9/8/2023 2:05 PM, Simon Clubley wrote:
>> Unfortunately, I _do_ have to use PHP sometimes.
>>
>> It didn't take me long to establish some solid rules, such as strict
>> comparisons at _all_ times, and to use a monitor library I wrote that
>> has the allowed error level turned all the way down so that things
>> which PHP normally allows through generate an error instead.
>>
>> |PHP is built to keep chugging along at all costs. When faced with either
>> |doing something nonsensical or aborting with an error, it will do something
>> |nonsensical. Anything is better than nothing.
>>
>> It is a horrible, horrible, language that like Javascript has been
>> turned from something used for writing little scripts into something
>> used to write mission-critical and highly sensitive applications,
>> which neither of them are suitable for.
>>
>>  From that page:
>>
>> |PHP is built to keep chugging along at all costs. When faced with either
>> |doing something nonsensical or aborting with an error, it will do something
>> |nonsensical. Anything is better than nothing.
>>
>> That sums up the language perfectly (and the same mindset is equally true
>> for Javascript in IMHO). They were both designed for quick hacks, not for
>> serious mission-critical applications.
>
> PHP actually follows the same rules as most languages:
>   not able to continue => error
>   able to continue => warning
>   error => stop execution
>   warning => continue execution
>
> But PHP does allow some constructs that other languages do not.
>
> As an example:
>
> <?php
>
> class C { }
>
> function check($lbl, $v) {
>     $vv = $v ? 'true' : 'false';
>     echo "$lbl is $vv\r\n";
> }
>
> check('true', true);
> check('false', false);
> check('123', 123);
> check('"ABC"', 'ABC');
> check('0', 0);
> check('""', '');
> check('"0"', '0');
> check('(instance of C)', new C());
> check('null', null);
>
> ?>
>
> outputs:
>
> true is true
> false is false
> 123 is true
> "ABC" is true
> 0 is false
> "" is false
> "0" is false
> (instance of C) is true
> null is false
>
> But languages get designed for certain purposes/contexts/users.

Like ego ?

> PHP was designed to allow people that does not understand
> data types to write code.

Perhaps people who cannot understand something as simple as a data type should 
not write code ?

> If people do not understand the difference between boolean
> data type and other data types, then PHP behavior makes sense.

See above ...

> There is little point in criticizing a language for meeting
> its design goals.

But there is great point in criticizing the design and goals.

> The question is whether the language is a good choice for
> a specific context.
>
> I have no idea whether PHP was the right or the wrong choice
> for your web application.
>
> There is a pretty big majority in the IT industry that believe
> type safe languages are not the right choice for web applications.
> Business critical web site or not.

There are quite a few idiots on the planet also.

> Just like you can ask a C compiler to not continue with
> warnings then you can do the same with PHP.
>
> function always_die($errno, $errstr, $errfile, $errline ) {
>     echo "$errstr in $errfile on line $errline";
>     die();
> }
> set_error_handler('always_die');
>
> will force PHP to stop at warnings and notices (PHP term for
> informationals).
>
> Arne
>
>
>


-- 
David Froble                       Tel: 724-529-0450
Dave Froble Enterprises, Inc.      E-Mail: davef at tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA  15486



More information about the Info-vax mailing list