473,834 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Will php ever do strong typing?


Will php 6 do strong typing and/or namespaces?

I was shocked to find out today that there are some people who actually
argue that weak typing is somehow better. I didn't even know there was
a debate. Shocking. That's like arguing that square tires are better
than round.

Anyway if anyone knows that php is going to intentionally stay weak in
the future let me know so I can jump ship, thanks,

mrb

Jul 17 '05 #1
53 9962
On 23 May 2005 15:33:58 -0700, dt******@hotmai l.com wrote:
Will php 6 do strong typing and/or namespaces?
AFAIK there's no decided feature set for PHP 6 yet.
I was shocked to find out today that there are some people who actually
argue that weak typing is somehow better. I didn't even know there was
a debate. Shocking. That's like arguing that square tires are better
than round.

Anyway if anyone knows that php is going to intentionally stay weak in
the future let me know so I can jump ship, thanks,


If PHP ever went strongly typed it would be a fundamental change to the
language. It's not at all likely to happen IMHO. (You probably want to stay
away from Perl as well).

--
Andy Hassall / <an**@andyh.co. uk> / <http://www.andyh.co.uk >
<http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2
dt******@hotmai l.com wrote:
Will php 6 do strong typing and/or namespaces?

I was shocked to find out today that there are some people who actually argue that weak typing is somehow better.
I completely agree. Strong typing makes far more sense due to the
compile-time constraints it enforces. Anyone who thinks otherwise is
lazy, quite frankly, and isn't thinking in terms of long-term
maintainability and debugging.

It also buggers up the fundamental point of OOP, i.e. polymorphism.
Anyway if anyone knows that php is going to intentionally stay weak in the future let me know so I can jump ship, thanks,


Scripting langauges are not compiled, in general. Therefore most don't
seem to use strong typing, because there's no compiler to catch this
sort of thing. e.g. PHP, Perl, VB, VBscript, Javascript. I don't think
this is likely to change in the future. As Andy says, this would be a
fundamental paradigm shift in any language.

Also, I think languages like PHP are designed for people who don't know
much about "proper" programming. It's designed for people who just want
to throw something together that does the job. No need to worry about
algorithm optimisation, memory allocation or deallocation, hash-table
searching, string handling, type-casting, or indeed typing in general.

--
Oli

Jul 17 '05 #3
Oli Filth wrote (in part):
Also, I think languages like PHP are designed for people who don't know much about "proper" programming. It's designed for people who just want to throw something together that does the job. No need to worry about
algorithm optimisation, memory allocation or deallocation, hash-table
searching, string handling, type-casting, or indeed typing in

general.

Them thar's fight'en words.... :-)

I use PHP because it's easy to program and to get the job done.

<dating myself on>
I have been involved with computers since 1969! Pre Internet, Pre
ARPAnet, Pre OOP, almost Pre CRTs, Pre PCs, Pre MAC, PRE WEB ... the
punch-card era. I've seen the introduction of OOP, I've see "Go To"
less programming, I've seen the "Come From" counter rebellion...
<dating myself off>

Fine, if you don't like PHP because it isn't OOP and strongly typed,
don't use it, but don't expect everyone to agree with you. Find a
programming language you like, use it to interface to the WEB servers
as a CGI. Or, create your own language that can be used with the web
servers, prove to everyone that it is better than what is already out
there. And while you're at it, make sure that it does an excellent job
at catching array overflows and boundary checking. Make sure no one can
use it to write malicious code.

Ken

Jul 17 '05 #4
Ken Robinson wrote:
Oli Filth wrote (in part):
Also, I think languages like PHP are designed for people who don't know
much about "proper" programming. It's designed for people who just

want
to throw something together that does the job. No need to worry about algorithm optimisation, memory allocation or deallocation, hash-table searching, string handling, type-casting, or indeed typing in

general.

Them thar's fight'en words.... :-)

I use PHP because it's easy to program and to get the job done.

<dating myself on>
I have been involved with computers since 1969! Pre Internet, Pre
ARPAnet, Pre OOP, almost Pre CRTs, Pre PCs, Pre MAC, PRE WEB ... the
punch-card era. I've seen the introduction of OOP, I've see "Go To"
less programming, I've seen the "Come From" counter rebellion...
<dating myself off>

Fine, if you don't like PHP because it isn't OOP and strongly typed,
don't use it, but don't expect everyone to agree with you.


I'm not disagreeing with you! I like PHP for the same reason you do: it
gets stuff done *very* quickly.

But you can't deny that PHP hides one hell of a lot of nitty-gritty
low-level (and even standard high-level) stuff from you, so that the
average PHP user can safely assume that, for instance, arrays can
safely be indexed by strings (even though this isn't done natively in
any compiled language that I can think of). But sometimes this stuff is
important. Especially in large, non-trivial systems.
Find a
programming language you like, use it to interface to the WEB servers
as a CGI. Or, create your own language that can be used with the web
servers, prove to everyone that it is better than what is already out
there. And while you're at it, make sure that it does an excellent job at catching array overflows and boundary checking. Make sure no one can use it to write malicious code.


Again, I'm not disagreeing with you. But from a progammatic point of
view (i.e. "what is my script *actually* doing?"), PHP is not the best
answer. If you are used to a language where compile-time and link-time
catch a large number of syntax errors, silly mistakes and algorithmic
boo-boos (e.g. comparing a string with an integer, which doesn't make
sense in e.g. C), then PHP is going to look pretty basic. If this check
isn't even performed at load-time, then debugging becomes a very
hit-and-miss affair.

And when you consider that many PHP programmers consider eval() to be
an acceptable way of achieving things, the problem becomes even worse.

Like I said before, PHP (along with many scripting languages such as
Javascript and Perl) seems to be designed to get stuff done in an
extremely high-level, abstract way, where even things like object types
are (essentially) irrelevant. Except at run-time, when they bite you in
the arse 6 months down the line if you've screwed up. If only they bit
you in the arse at compile-time (which doesn't exist)...

(P.S. IMO, any language without pointers (and pointer arithmetic) isn't
a real language!!)

--
Oli

Jul 17 '05 #5
Great, just what we need, flame bait.

Jul 17 '05 #6
Oli Filth wrote:
Also, I think languages like PHP are designed for people who don't know much about "proper" programming.


I should probably point out that by this, I do *not* mean that everyone
who uses PHP is some kind of retard. Far from it. I am just stating
that one of its original design objectives was to be a language that
anyone could pick up, with little (or no) programming experience.
Therefore, lots of typical programming issues have been made completely
transparent to the PHP programmer.

--
Oli

Jul 17 '05 #7
I would also not mind if they would somehow inplement strong typing in
PHP, but I really don't see that happening. It is one of the things I
like about C++ (and Java) and in this area I would like it if PHP was
more like those languages. I am kind of using strong typing already by
prefixing any variable-name with a letter (i for int, s for string, a
for array...).

I would also like to see the OOP and pointers of C++, although I hate
pointers, but that's just because I'm appearantly to stupid to use them
effectively.

One thing I really really like about PHP however, is how it handles
arrays. I hate the C++ mechanism where you have to specify the length
of the array and it is then fixed... I hope they never touch that in
PHP.

Jul 17 '05 #8

Jordi wrote:
One thing I really really like about PHP however, is how it handles
arrays. I hate the C++ mechanism where you have to specify the length
of the array and it is then fixed... I hope they never touch that in
PHP.


Pretty much every other modern language besides C and cpp will let you
freely add and delete from arrays. perl, java, php, python, javascript,
c#, whatever.

Jul 17 '05 #9
Use === instead of ==.

Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

94
4760
by: Gabriel Zachmann | last post by:
Is it correct to say that strong/weak typing does not make a difference if one does not use any pointers (or adress-taking operator)? More concretely, I am thinking particularly of Python vs C++. So, are there any examples (without pointers, references, or adress-taking), which would have a different result in Python and in C++? I would appreciate all insights or pointers to literature. TIA,
5
2695
by: Lyle Fairfield | last post by:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callnetfrcom.asp The Joy of Interoperability Sometimes a revolution in programming forces you to abandon all that's come before. To take an extreme example, suppose you have been writing Visual Basic applications for years now. If you're like many developers, you will have built up a substantial inventory of code in that time. And if you've been following...
0
9651
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10225
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7762
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6960
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5629
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5800
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3987
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3085
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.