开发者

What makes some programming languages more powerful than others? [closed]

开发者 https://www.devze.com 2023-01-21 09:12 出处:网络
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references,or expertise, but this question will likely solicit debate, a
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 12 years ago.

I'm going to reveal my ignorance here, but in my defense, I'm an accounting major, and I've never taken a computer science class.

I'm about to start a new project, and I'm considering using Python instead of PHP, even though I am much more adept with PHP, because I have heard that Python is a more powerful language. That got me wondering, what makes one programming language more powerful than another开发者_如何转开发? I figure javascript isn't very powerful because it (generally) runs inside a browser. But, why is Python more powerful than PHP? In each case, I'm giving instructions to the computer, so why are some languages better at interpreting and executing these instructions? How do I know how much "power" I actually need for a specific project?


When Paul Graham talked about Lisp being the most powerful language available, he meant most expressive. You can express any program in any turing complete language. That's the whole point. What makes one language better than another (for a particular task) is its ability to define a given program more concisely or clearly. For most programming tasks, that's what matters.

Occasionally (and I mean very occasionally) performance starts to play a role, and features like the ability to embed assembly language easily in your program matters. But for the most part, it's about the ability to express your ideas clearly and concisely.


I hate statements of the sort "language X is more powerful than Y." The real question is which language makes you more powerful. If language X allows you to write better code (that works) faster than Y does then, yes, X is more "powerful".

If you are looking for an objective explanation of language powerful-ness ... well, good luck with that.


It's not really a matter of power, but a matter of what you're trying to do and how you try to do it. You could say that Python is "more powerful" because it comes with a large set of built-in libraries, or that C++ is "more powerful" because it's much faster, or that Haskell is "more powerful" because it uses lazy evaluation - in short, it's really a matter of opinion. But I haven't seen many desktop apps written in PHP, and I don't see web apps written in C++ (though there are probably exceptions, of course).

Some languages simply offer what is considered an "elegant" way to perform certain tasks. For instance, look at a factorial function in Haskell:

factorial 0 = 1
factorial n = n * factorial (n-1)

Some might consider this elegant mainly because it reflects the mathematical definition clearly. But is this better than another implementation? No. (Especially since this would overflow the stack.)

In conclusion, use what you feel is best for your task - if you're best with PHP, and you don't want to learn Python, than don't. If you're interested in what it's like, then check it out. Don't learn it because it's "more powerful."


I would not say that there are computer languages "more powerful", just languages more suited for your specific problem domain.

That said, PHP is a language that evolved from a hack and tailored for a very specific problem domain; this shows up in several places, like for example inconsistent parameter order across database interfaces. IMHO PHP community has made some very sad decisions for new syntax enhancements over the time.

IMHO Python is much more general, well designed and elegant, but your question is one that usually starts flamewars.


The stock answer is the only features that make certain languages more powerful than others are language features that cannot be easily replaced by adding libraries.

This definition will almost always list LISP on the top, but has the odd side effect of listing assembly near the top unless special care is taken to exclude it.


Its an interesting topic and in my line of word I come across this a lot. But I've discovered 'power' in the literal sense no longer has value when it comes to the language. What I fear those telling you 'python is more' powerful are getting mixed up with the language and the implementation.

I'm a recent convert to python (last 2 weeks) previously I was a PHP coder. The libraries made on top of the language of python - namely django -help make the language more powerful - as its faster to use and build upon.

PHP has the fable 'if you want to do something. there is a function for it' and the documentation is brilliant - therefore powerful in that sense.

And in regards to interpreting the language - again dependant upon who has been coding it - its no matter. By general consensus python may be considered quicker and less CPU intensive, is it creates compiled versions of your code. But PHP can have a good caching system.

In short - Pick you favorite.

0

精彩评论

暂无评论...
验证码 换一张
取 消