RE: [PHP] Strong typing?

From: Date: Fri, 13 Jul 2001 16:13:13 +0000
Subject: RE: [PHP] Strong typing?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-57747@lists.php.net to get a copy of this message
and as far as i know, perl's 'strict mode' has absolutely nothing to do with typing of variables... use strict; will force you to define all variables with "my $var;" or "local $var;" before you assign values to them or try and use them... but it doesnt do anything about enforcing typing... in perl 6, i think that plans are under way to add extensions that will let people strongly-type variables if they want (but it still wont be mandatory) example: my integer $number = 5; would stronlgy-type that variable as an integer, and you wouldnt be able to assign any other type of value to it without an error. but i dont know how far the developers will go towards realizing strongly-typed extensions to perl... as rasmus said... it's incredibly hard to have it both ways. the freedom of perl and PHP largely comes from *not* having to always worry about variable typing, memory allocation/cleanup and all those other nitpicky low-level things that BDSM ... errr.... C programmers seem to love :-) > -----Original Message----- > From: Rasmus Lerdorf [mailto:rasmus@php.net] > Sent: Thursday, July 12, 2001 8:15 PM > To: Dr. Evil > Cc: php-general@lists.php.net > Subject: Re: [PHP] Strong typing? > > > > PHP is a great language. It makes it fast and easy to create web > > pages. However, one feature which is critical for doing rock-solid > > stable websites is strong typing. The reason for this is that you're > > dealing with untrusted user input. Strong typing helps because if you > > are expecting an INT, and the user gave you something else, and you > > made a mistake in your input checking, the program will fail when you > > attempt to assign the value to the strongly-type INT variable. This > > is a good thing when you are dealing with money, or other contexts > > where you need very solid code. > > > > First, is there a plan to introduce a strong typing option, like > > perl's strict mode? > > > > Second, is there a way to get something equivalent to strong typing > > using the class system? > > You can't really have it both ways. And no, there is no plan to implement > strong typing. > > -Rasmus > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#57747) next »