Re: Strict types
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Thu, 30 Mar 2006 08:23:17 -0500
Treefrog wrote:
Hi All,
For a while now I've been wishing PHP had (at least the option to
enable) strict types. It would help a massive amount in BIG
applications, and maybe start to taper the millions of lines of crap
code that's out there.
PHP is a great language, but the masses of incompetant coders out there
do absolutely nothing to help the language grow. I know we all have to
start somewhere, so please don't think I'm being eliteist, because I'm
not, but something has to be done to try to fix the mess out there.
Surely the contractors on here have witnessed this, or is it just me?
What is everyone else's opinion?
Cheers,
T'rog
Hi, T'rog,
Well, one of the big attractions to PHP is the lack of strict typing. You don't have to go through all the overhead of declaring variable types (or even variables unless they are class members). Getting rid of the "administrative overhead" allows you to concentrate on the problem.
You can write good code in any language (except maybe COBOL :-) ). You can write bad code in any language - including Java and C++. However, IMHO, strict typing does in general get you to write "better" code.
I think a good compromise between old and new would be a "strict" flag. It could be set in the php.ini file or .htaccess (on Apache, if allowed). Perhaps it could even be a parse-time command (ini_set isn't executed until too late), similar to C/C++'s pragma statement. The last would allow someone to convert a website one file at a time to strict. Then when everything's changed, change the php.ini file, or, if on a shared server, at a statement to .htaccess.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- Strict types
- From: Treefrog
- Strict types
- Prev by Date: Re: 1 Form, 2 Actions?
- Next by Date: Re: 1 Form, 2 Actions?
- Previous by thread: Re: Strict types
- Next by thread: Re: Strict types
- Index(es):
Relevant Pages
|