Hacker News new | past | comments | ask | show | jobs | submit login

I doubt it's a minority opinion, at the very least amongst PHP devs. Having it as a string allows me to pass it to a logging function, or output it in a debug console, or send it to a query pre-processor that adds the right database prefix for the current app, etc.



You never lose capabilities by adding semantic structure. It's trivial to flatten that out with a toString of some kind.


As encoderer said, you can definitely do that in Linq. The query operators basically just map to methods, which are overridden by the different providers... The SQL ones basically create SQL statements for you behind the scenes (as log gable strings).

I thought it was all kind of weird and wrong at first too but now it's probably my favorite c# feature next to the (very much related) lambda expressions, especially for non-SQL collection queries. Of course this doesn't mean PHP needs integrated queries or anything, but it is a very nice feature to have if done right. XML/json literals, on the other hand, do feel kind of wrong to me though (although I bet they are handy still, as many vb.net devs will probably attest to).

[Edited for spelling - damn ipad keyboard!]


You're making the assumption that you'd lose that functionality if you moved to a language integrated query? Not so.

Take a look at the Linq implementation for a good example. Or, look at something like JSON in javascript.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: