HN user

heron87

14 karma
Posts0
Comments5
View on HN
No posts found.

No offense intended. I just have a slightly different understanding of a "scripting language": a — often domain-specific — language that is merely used to write small scripts/macros. But anyway, I did not want to start a discussion about that. Sorry for that.

High Quality PHP 13 years ago

I believe "high quality PHP" is an oxymoron. It's just impossible to be aware of all the pitfalls PHP contains. Here is just one example among many:

if( '33333333333333333333' == '33333333333333333334' ) echo "equal"; Output: "equal"

The "reason" for this very odd behaviour is that the two strings are automatically converted into integers, which leads to an int overflow, which PHP ignores (ignoring errors is very PHP specific) by guessing that the two "numbers" must be equal. I'm sure they even call this a feature...

P = NP 13 years ago

Not sure what you mean by "memory requirement" and "theoretical time". If you don't access the memory, what do you mean by saying you "need" it? If a turing machine — or a computer program, for that matter — uses, i.e., "visits", exponentially many memory cells, then, indeed, its computing time cannot be polynomial. But note that every turing machine theoretically has infinite memory. The question is how much of it is actually used. PSPACE consists of those problems that can be solved by a turing machine that uses no more than p(n) memory, where p(n) is some polynomial in the input length n. Note that, for PSAPCE, time is unrestricted. So obviously P and NP are subsets of PSPACE, but it is unknown whether they are proper subsets.

P = NP 13 years ago

A definition of P indeed does not require a restriction on memory use. But the definition implies a restriction on memory: a polynomially bounded (in time) machine cannot use exponential memory (because reading 2^n cells on a tape requires 2^n time steps).