PHP Gets Namespace Separators, With a Twist
jeevesbond writes "PHP is finally getting support for namespaces. However, after a couple hours of conversation, the developers picked '\' as the separator, instead of the more popular '::'. Fredrik Holmström points out some problems with this approach. The criteria for selection were ease of typing and parsing, how hard it was to make a typo, IDE compatibility, and the number of characters."
... and comming full circle.
Onda Technology Institute
dot?
php now is anti-slash dot?
"Steve Jobs invented the world" -- Bill W. GATES
PHP 5.3 also adds support for local GOTOs. This langauge is so up with the times.
I couldn\'t read the summary because it had an unterminated string literal.
Being different to be different, aren't we?
There's obvious drawbacks for using a period (.) as a string concatenator, it's easy to put strings together since typing a period is a lot easier than a plus (+), but this means you can't use a period for namespaces as many OO coders are used to..
It'll be /, just to keep things interesting.
...to make PHP the most retarded computer programming language on the planet.
It takes a man to suffer ignorance and smile
Be yourself no matter what they say
While at it, they should have picked a page from the W3C and made namespaces full, compliant URIs.
That would have been epic! /sarcasm.
The rfc claims that typing "**" is easier than typing "%%" or "^^".
Do you even lift?
These aren't the 'roids you're looking for.
As a developer who primarily works with C#/.Net, with a little PHP on the side, IMO this addition is long overdue. It would be nice to have a more standard separator, but when I RTFA they seem to have a just reason for it, and it's using semantics that PHP coders are used to. I will happily adjust myself in this ONE manor in order to reap the MANY benefits of namespaces.
Just my 2 cents.
Where genius and insanity become confused true wisdom is found
I once did a lot of work on PHP. Today, when people ask me for upgrades I just migrate it to Python.
This unfortunate choice of the escape character for namespace separator is stupid, but seems almost irrelevant to me. How many nails do they need in the PHP coffin to bury it?
Just make sure they name it a backslash in the documentation, not a slash.
... to cause for windows servers...
imagine what directories will be deleted due to a typo!
F\ck :P
OMFG - this addition is just so horrid that everyone's going to give up on PHP and start coding Web apps in C++ through CGI interfaces again. /Sarcasm
Seriously, who cares what charater they are using? Developers are smart enough to adapt.
This means eternal war!
Dislike the Electoral College? Lobby your state to join the National Popular Vote Interstate Compact.
Maybe they could starting fixing the noun-verb vs verb-noun problems instead.
Selling software wont make you money, selling a service will.
The number of days that an old, crusty Perl developer can laugh at another language are few and far between.
Thank you, PHP.
Is the problem that they chose something 'different' than what everyone else uses, or is there a real technical reason behind the snarkiness? I think it's a good thing they even considered the issues involved, though I'd disagree with the 'ease of typing' issue - once your fingers leave the home row, you dramatically increase the chances of a typo. People who aren't touch typists have some pretty serious misunderstandings about typing ease. (Hello, Apple keyboard designers, I'm looking at you.)
OK, yes Python is better than PHP but they're both a pain in the ass for the web/text based world of web development. I mean really, both PHP and Python are not that much easier to use than just writing a program in C/C++. Things like regular expressions are stupidly annoying to use (compare to Perl or Lua+LPeg). I don't even get the point of Python because it's a slow scripting language with almost all the verbose complexity of a compiled language. Just weird.
Unfortunately there aren't a lot of options. Perl isn't all that great because while it's awesome at the usability and text processing part it's not so good from a structured design point of view. It's difficult to design complicated software in Perl. Plus Perl is basically dead since they decided to start that idiotic Perl 6 project that will never be finished (and even if it is I'm sure it will suck).
My personal choice would be something like Lua with LPeg and a nice large supporting library. I know the Kepler project does work in this space but their stuff isn't anywhere near as nice as what is available in PHP and Perl API's. Their designs are just odd because they approach things from a Lua point of view instead of a web developer point of view.
It's interesting to see what the Phalanger guys are going to do now. They've already been using ":::" as a namespace separator for their .NET/CLR language extensions, as the next most logical choice. And now this.
On the whole, though, this is probably just as bad as using "." for string concatenation (it was sort of okay for Perl because back then it wasn't yet used ubiquitously as a member access operator, but for PHP, it was a dumb choice). Backslash has a near-universal meaning as an escape character for several large language families now (all curly-braces family languages - C/C++/Java/C#/EcmaScript, and almost all modern popular scripting languages - Python, Ruby, Lua...). It's even used as the same in PHP, given that it is also a curly-braces language. Reusing it outside string literals in an entirely different capacity is not a good idea (especially when other languages of the family have already applied different meaning to backslash outside string literals - in C# and Java it's used to escape Unicode characters in identifiers).
How is it possible for even American developers to be this clueless. Which characters are convenient to type depends entirely on the keyboard layout that is used. Case in point, $ is insanely painful to type on Scandinavian layout.
If your choice of characters used in your programming language is affected by how easy/hard it is to parse the code, you probably shouldn't be involved in developing a programming language.
... are just another language. They all do the same stuff and 95% of what you want to do happens in the library anyway, so the language is just a framework for iterating your library calls or instantiating your objects if you prefer. They all have corners of stupidity you have to work around - some more than others, but what does it matter really?
Help stamp out iliturcy.
Except you just made a typo. It is "\" instead.
Either way, most languages use either "." or "::" for namespaces
# perl looks like
use My::CPAN::Module qw();
my $instance = My::CPAN::Module->new("junk");
# c# looks like
using System.Windows.Controls;
System.Windows.Controls.ListBox box = new System.Windows.Controls.ListBox();
# c++ looks like (I think)
namespace Blah::Blah;
# php will now look like
$object_instance = new My\PEAR\Module("myvar");
I'll leave the "looks" of PHP's method to the reader.
Looking at the IRC discussion it seems that they didn't have much of a choice.
Scripting languages are for those of a weak mind and poor technical skills and the singular lack of the ability to plan a system out before you write one line of code.
Or for projects that need to be compiled at runtime. But, nice magnanimity.
Ahaha...this comment cracked me up. You must not do any client work, huh.
concrete5: a cms made for marketing, but strong enough for geeks.
At least in a sense. You can map a .NET namespace to an XML namespace. Say you have namespace that is:
Shados.Awesome.Controls
You can map that into:
http://www.shados.com/controls
In c# you'd plunk this into your AssemblyInfo.cs file:
[XmlnsDefinition("Shadows.Awesome.Controls","http://www.shados.com/controls")]
And thus add it to your XAML code:
<UserControl xmlns="http://www.microsoft.com/xml/something"
xmlns:shadow="http://www.shados.com/controls">
<shadow:AwesomeControl x:Name="myControl" param="aParam"
</UserControl>
You can even get multiple .NET namespaces to map into a single XML namespace.
Sure, why not, right? Let's reinvent the wheel EVERY FUCKING TIME we write the specs for a language. We don't want anyone getting comfortable now. Shit, let's make sure we use EBCDIC encoding for PHP7, too -- hey, don't complain, it's a scripting language! That's the deal!
You are a narrow-minded BUFFOON, sir.
Yeah, you don't need insight to know the developers were high as a kite.
For additionnal fun, read this: http://wiki.php.net/rfc/namespaceseparator
Looks like they considered stuff like :> and :) as separators for namespace. Seriously.
Also, they don't give any malus for tybe-ability to \ while on most european keyboards it's a lot harder than any other suggested separator. Way to go !
You know what they say:
If you don't like it, you can go fork yourself.
Table-ized A.I.
Let me know when C has closures and introspection. Sure, you can do it, but the result is so ugly and messy it severely obscures the meaning of the code. That, my friend, is the problem with C. Unless you really really need that last ounce of performance, or you are writing systems software, C is almost never a good choice.
Um, that should be "especially for DOS / Windows users". Unix was here first dumb asses
Furthermore, using the character, that just about every other programming language uses for the escape character, as an operator (or separator) is just plain stupid -- I'm also talking to you Microsoft, but that horse has definitely left the barn...
It must have been something you assimilated. . . .
Now do you have to escape your namespaces before passing them through eval?
eval("$instance = new My\\Super\\Class(\"blah\"););
Since they now are using the escape character for namespaces, I wonder what kinds of security implications this might have? What happens when a PHP program for some reason evals() some user input that doesn't properly escape the namespaces?
The real question is: will they admit their mistake and correct it before it destroys the community?
The linked blog showing the example: spl_autoload_register(array("Foo\tBar", "loader")); highlights the fact that this is an epic blunder that will fracture the community.
The language designers who spent only "hours" debating the solution need to swallow their pride and admit they made a mistake. Then they should take public comments on how to solve the problem, and put it to a popular vote among the user community.
I took it as an extremely well crafted troll.
Nerd rage is the funniest rage.
Stupid choice. I guess I will just endeavor to avoid namespaces altogether.
Does this mean that writing "eval" statements in regular expressions would have to be triple-escaped then?
preg_replace("/oldtext/e", "ns\\\pick_new_text()");
That makes my head hurt.
This is terrible or it is a joke?, I knew PHP is just an ugly hack and not a language. PHP desperately need a good language designer or better PHP people go with Perl or Python.
There is no language in which it is faster to prototype small algorithmically intricate scripts (for straightfoward stuff, I use the shell). This used to be a great boon (and amusement) in college, where the homework assignment that people slaved on for a day or two in Java or C++ or C would take me less than 2 hours to do (typically right before the deadline too).
Merely due to its built-in hashtable and the wide variety of functions to manipulate it, it is quick, natural and painless to churn out algorithms in PHP.
Oh yes, for other things, it sucks. For big projects, I like C or python.
This is the typical bastard that thinks is a real programmer, let me tell you that there are more complex systems right now in scripting languages than in C. Get a life stupid.
Anything you can do in ANY scripting language ... you can build faster, smaller and better programs in C.
And anything you can build in C, I can more quickly build smaller, better and more reliable in Haskell. I guess by your logic the pansy type system of C/C++ is only for those of weak mind and poor technical skills.
(*) I know C++ people like to think they have a strong type system. And relative to some languages it is, but compared to the full Hindley-Milner, System-F Glory of the Haskell type system C++ doesn't stand a chance. Of course even Haskell is weak compared to systems like Agda.
surely slashdot had nothing to do with this ;) /.
Umm C# would be.
using System.Windows.Controls;
ListBox box = new ListBox();
Just take this to backslashdot.org pls. Thank you. Sheesh.
Since PHP is open source, someone will make a fork with a different separator and the dumber of the two choices will wither away.
It's simple: I demand prosecution for torture.
Oh yeah, because you know, I'd rather type one character than two to namespace when I'm using mysql_real_escape_string() and its ilk.
A huge part of the reason I hated PHP coding (and why I've stopped) was because it's just a shit-ton to write. There's just a lot of typing that needs doing. I'm a fan of descriptive function names, but there_comes_a_point_where_its_too_fucking_much().
Compared to languages like Ruby or Python, PHP requires you to type more to do less, worse. I've never met a developer who liked PHP over another language, and the only people I know who like PHP like it because it's all they know, or because they make money off its idiocies (like teaching long, complicated classes on how to write PHP).
This is just another step towards PHP not being taken seriously... more.
You can write smaller, more compact & light weight server side programs in C then you can for just about anything else.
You obviously haven't seen just about anything else. I present Sinatra as Exhibit A:
Show me how that's done in C, so that I can laugh in your face.
If you're talking about performance, you have a point. Unfortunately, it's not a very good one. Programmers are expensive. CPU isn't. And the Web is one place where, if needed, you can simply throw more CPU at the problem.
"Smaller" and "more compact" are properties which are much more useful when applied to the source code, not the result.
Scripting languages are for convenience, nothing more nothing less.
Yes. High-level languages are for convenience.
C is a high-level language.
I'm not kidding. C was a tough sell over assembly at the time. It was actually sold on a lie -- that function calls were cheap. The original Unix spent over half its time in function calls -- but by then, it was too late. People had realized the benefit of high-level languages, and no one wanted to go back to assembly for a whole OS.
Now it's happening again, and you are the crusty old get-off-my-lawn programmer who would still be writing in assembly, if you'd been around when C was the hot new thing.
Native binary languages for *nix system have all the same goodies in them just written at lower levels
Which, by definition, means they don't have the same goodies.
Come back when C can do closures. Or reflection. Or lazy evaluation. Or transparent, opportunistic threading.
These things are useful because they're high-level. If C natively supported them, C would become quite a lot higher-level. As it turns out, you'd have to do quite a lot of low-level work to get these in C, which would defeat the purpose -- or you'd have to build a layer on top of C to handle it for you.
I work with such a layer. It's called Ruby.
and you have to do a little work, or god forbid, some memory management
I have no problem doing memory management, if there's a point. If it has, y'know, any relevance to the problem at hand.
But malloc and free have absolutely nothing to do with rendering HTML, parsing RSS, talking SQL to the database, or any of the other things I'm actually doing.
Sure, they're called behind the scenes, but that's not the point -- so is MOV, CALL, JMP, and so on. Just why is it that you like C, and not assembly?
Scripting languages are for those of a weak mind and poor technical skills and the singular lack of the ability to plan a system out before you write one line of code.
When was the last time you were employed? Scripting languages are for those on a budget and a deadline.
For that matter, what have you done in LISP? If it's the higher-level people who have the "weak mind", it should be easy for you to grok macros, reflection, lambda closures, and iterators, right?
And if you can plan the entire system out before you write one line of code, great, congrats to you.
Except I'll be halfway through implementing it while you're planning it out ahead of time, and I'll be able to actually react when the requirements change. I doubt your superior mind can actually see into the future and predict new things you might have to add.
One more cheap shot before I go -- When you have to port your 32-bit C app to 64-bit, how much did you have to change? It's possible it just recompiled, but for most real-world C apps, it takes at least some effort. And that assumes you've stuck to the subset of POSIX which is reliably implemented everywhere, so you don't have to port between OSes.
I
Don't thank God, thank a doctor!
Then I see people suggesting \ for a namespace separator, and I wonder what happened to all the people that put so much work into making PHP5 good, and why we can't get them back.
The answer is right there under your nose.
Inability to make up for poor design keeps the good people away. This is just another day in PHP-land.
I personally threw in the towel when I found out how fatally flawed the magic constant __FILE__ is and how unwilling the PHP developers are to do anything about it.
Anyone wanting a different view on this, try Googling "technological debt".
I had a coule extension in PHP, but they eventually got pulled. No biggie, I guess, but my experience with PHP was not pleasant.
I don't want to bash the project because there are a number of very good people on it, but there is a tendency to operate in isolation and the team sort of falls into a click. They'll make decisions on IRC and you don't hear about it until they screw with your extension. It is run by a relatively small group of people who don't think much bigger than that.
So, when they come up with an obviously brain-dead boner like this, no one should be surprised.
I've never fully got into Python as I felt my hands were full with PHP, Javascript and Java but the PHP guys keep doing stupid shit and the more I've gotten into Java the more unprofessional PHP felt and I think this is the straw the broken the camel's back.
I really get the impression sometimes that they're not interesting in making a good language. They're happy with the fact it's an easy language that a lot of web developers use purely because it's easy to knock out a few scripts. I want something more than a language that panders to half-wits.
I'll see how I get on with Python and if, need be, I can always fall back to using JSP.
In C++ you use
namespace Blah::Blah {
class Foo {
}
to define stuff in a namespace, and
using namespace Blah::Blah;
to import names from another namespace.
Common Lisp uses blah:identifier for public symbols and you can also write blah::identifier (with two colons) to access private names of a package if you know what you're doing. The default package for a source file is set by (in-package blah)
It's a damn shame this post was modded troll. Slashdot used to have a lot of actual software designers, and not these scripting language lightweights who need every safety-net in the book to save them from themselves. A quick hint to the weak sisters out there: programming language selection isn't going to turn you into a competent designer. Crutch features like VMs, GCs, etc. just prevent you from learning your craft with no long-term benefit.
PHP source code is already cluttered with symbols like ->, : and $ (and those horrible $this-> everywhere...) and now \ ...
Really, PHP code is ugly. Why does PHP need this, while Ruby is way more elegant without missing any feature?
{{.sig}}
I understand they messed up parsing foo::bar as one method... so why not just do namespace:::foo::bar ? ::: is still far from standard, but less god awful than "\".
If ::: means something in the PHP universe (I set the language down years ago), then they could do ":.:" and make both C# and Perl programmers happy in one swoop!
The Tao gave birth to machine language. Machine language gave birth to the assembler.
The assembler gave birth to the compiler. Now there are ten thousand languages.
Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao.
But do not program in COBOL if you can avoid it.
- The Tao of Programming
Help stamp out iliturcy.
Pray tell, what absolutely needs to be compiled at run-time?
Hey KID! Yeah you, get the fuck off my lawn!
I don't know what the trollish GP meant by "scripting languages", but then I'm not sure what you mean by them, either. So, do tell - what difference does it make whether a language is "scripting" or not when it needs to be compiled at run-time? Java is compiled at run-time in JSP, C# is compiled at run-time in ASP.NET - and I haven't heard anyone calling those two "scripting", at least.
No, you don't. C++ does not let you nest identifiers when defining a namespace, so you have to do full nesting by yourself:
I think the whole thing is a joke by the developers. I mean look at the table of evaluation criteria in one of the linked articles: '**' is easier to type than '^^'? Using '\' has the best parse-ability? Plus they did not even evaluate '::'. Come on - when things are this crazy it's usually a joke...I hope!
Just as nothing needs to be precompiled, nothing needs to be compiled at runtime, either. That said, some things are more amenable to one or the other.
I have been a PHP developer since the 3.0 days, and I really like PHP. But the people making the decisions and Zend now are making the wrong ones! How am I supposed to promote my language with idiotic syntax like this? As much as I wanted namespaces, I don't think I will use them now. The syntax is just dumb and confusing -- not that PHP source code is all that "pretty" anyway! Maybe I should go back to a real programming language like Java, C# or ObjC -- *sigh*. Too bad they don't make a mod_ecmascript. I kinda like the Javascript syntax. For python people -- I HATE, HATE, HATE the fact that there are no opening and closing indicators for control blocks! -- maybe it is something you get used to.
They screwed up IDE compatibility. "\" should get a "-1" instead of a "+1". I also think that the difference between one and two characters for a token object token is largely irrelevant. What does "typeability" mean? Proximity to the center of the keyboard and "shift"-iness? Mostly, I think it looks UGLY.
I didn't use the term "scripting languages," and I can't answer for the GP since we clearly don't see eye to eye. I have no problem with run-time compiled languages; I use them.
Following in the tradition of paamayim nekudotayim (::), I'm going to propose that the name for the new operator be lokhsan achori (\).
Let me know when PHP has threads.
{{.sig}}
Well, I program in PHP for almost 9 to 10 years, I did the full programming from small to huge projects and now I can say I am getting ashamed of PHP day by day. And WTF? Even for me, with experience, \ is pretty ugly and stupid. As someone already pointed this is the global scaping character, which even PHP uses. Why not :: ? PHP is already a mix of C, C++ and Java, :: would mix like candies.
Slashdot still has a lot of those "actual" software designers, you know, the ones who assume that because you're not writing in C or Java you must be some kind of moron?
...they could do ":.:" and make both C# and Perl programmers happy in one swoop!
I can't speak for C# programmers, but I can assure you that Perl programmers would ridicule them far more for using ":.:" than for using "\".
$x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
$x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
Scripting languages are for convenience
Oh noes! God forbid computers might make life easier...
Snicker. You've just offloaded your incompetence to a small army of IT personnel that now needs to keep a farm of servers running 24x7. That army is expensive, the datacenter that needs to be used is expensive. The programmer is just a one time expense.
JavaScript manages it just fine. It's also weakly typed. eval() is a big help.
Yeah, screw those guys! I'll make my own PHP -- with blackjack! and hookers!
Soylent Green is peoplicious!
That's basically how they came to this decision:
PHP Developer A: Hey, when I'm inside a namespace, my code does not do the same thing as outside! I tried to fix it but because we are using :: alredy for separating classes and their members, it would just slow PHP down even more. Lets just switch the separator, I vote for \^^H\\^H^H "\\"
PHP Developer B: I see, the hardest part now is to agree on the separator, but I'm sure I can come up with a chart that makes your \"\\\\\" win.
...
I'm loosing my words here, they tried to solve a problem without even bothering to check if someone else solved it already.
Or in direct words to the PHP Team: Please *%/$@ at least USE GOOGLE, and you'll find other languages where :: or . or whatever WORKS JUST FINE.... AND FAST...
But OTOH maybe that'll make others switch away from PHP... Or while they're at it, from Windows... And from SUV's... *sigh*
Good bye!
Yeah, they actually had a smiley as seperator on the list. Now that might have been just as weird, but at least it would have been funny. They should've taken that.
We suffer more in our imagination than in reality. - Seneca
Exactly..
Most of these scripting languages were designed to extend base languages and make them more accessible to more people. The days of writing in assembler except for the most abstract and lowest level bits and parts are long over, although I do still enjoy writing in assembler simply because it makes me think down to the level of the machine and understand the costs of doing something one way or the other.
I have found that the various scripting languages out there are an outgrowth of someone who programmed in a lower level language and simply either got bored with it ( completely understandable ) or wanted to wrap all of the low level functions they had designed into something more accessible, hence all the various scripting languages have their roots firmly planted in the soil of C.
Now none of that means that you have to write this stuff in C, you could write them in pretty any of the lower level languages that have compilers that generate native binaries. Writing a good interpreter is not by any means trivial, it is hard work.
So to the root of my diatribe, I would wager that most of the people bitching about the architects of PHP using the backslash as a name space separator could not even begin to write something like PHP and yet they feel so qualified to raise their collective voices in protest and condemn the decision of dev's who quite obviously do so, to be nothing more then pretentious and self aggrandizing and thusly they should be regarded with scorn and ridicule.
As to me, yup I am in the over 50 crowd who's shoulders others stand on and I also stand on the shoulders of others who's are broader then my own.
Hey KID! Yeah you, get the fuck off my lawn!
The dot has been fired. Long live the slash.
with 4GB RAM machines with TB hard drives - and we're still worrying about "the number of characters".
Oh, please. Fucking nerds.
For the last forty years, we've been constrained by one pointless limitation after another, not to mention the complete inability of a PC to discern what is an identifier and what is command syntax if it has fucking SPACES in it.
Get your heads out of your asses.
And learn to type.
"Number of characters" - Jesus Baron von Christ!
Richard Steven Hack - This sig is TOO GODDAMN SHORT TO DO ANYTHING USEFUL WITH! MORONS!
calling a computer programmer a "software engineer" is like calling a crack whore a "courtesan".
There's no "engineering" involved for ninety nine percent of them.
Richard Steven Hack - This sig is TOO GODDAMN SHORT TO DO ANYTHING USEFUL WITH! MORONS!
Oh, the bitching and the whining I hear and read.
Cut it out allready.
PHP is a whacky PL. It allways has been, ever since it derived from Perl. Which explains quite a bit. And while I don't like the solution of using a backslash as namespace seperator and the totally off-the-mark easyer-to-type criterion (Something like 80% of the non-trivial PHP appliations are developed with non-english keyboards) and the utter bullshitting criterion table they've come up with - the solution they've presented is as good as any other. They probably also have technical reasons (xpath type stuff comes to mind) to do it this way. And no matter which way they'd have done it, it allways would've hurt someones feelings.
And let's be honest: As batshit crazy PHP is allready, wether or not namespace delimiters are well chosen really matters squat.
And as for the poo-flinging: You people just go on ranting about how PHP is crappy, imature and oh-so-dead in the water.
Meanwhile Joomla, Drupal, Typo3, Cake, Symfony, Prado, ZendFW and EZ Publish carry on getting the job done. And gaining market share.
We suffer more in our imagination than in reality. - Seneca
Yeah, PHP does a lot of things "with a twist".
sic transit gloria mundi
Yeah, and if you are running PHP on a Windows server, do you really need any more trouble?
sic transit gloria mundi
I didn't say PHP was great. But there are other "scripting" languages out there that do quite well and do have threads. Functional and dynamic languages like Lisp and co. have many of the features of scripting languages, but are technically compiled and perform quite well. Also, the threading models in C and C++ is extremely limited and easy to get wrong.
This sounds like a terrible idea to me. It will produce quoting hell for anybody using a form of Unix or Unix-inspired tools on the code. I've worked with flat databases with tagged fields where the field separator is line-initial backslash, and this is such a pain in the neck that the first thing I usually do is convert it to something else.
Remember, if it's more complex for the parser to understand, it's more complex for a human to understand.
What's easy for computers to parse (e.g., deeply nested S-expressions) is often very hard for people to parse. And what's easy for people to understand (like English) still defeats machines. So, please, stop making up facts.
Ruby is the VB of the scripting world (I though it was funny)
http://www.infoq.com/interviews/Languages-Ted-Neward
Often wrong but never in doubt.
I am Jack9.
Everyone knows me.
Snicker. You've just offloaded your incompetence to a small army of IT personnel that now needs to keep a farm of servers running 24x7.
s/incompetence/work. After that... so what?
That army is expensive, the datacenter that needs to be used is expensive.
It's really not.
The programmer is just a one time expense.
Absolutely not, especially in web development. Do you think Google would still be in business if they stopped developing after Version 1.0? Have you noticed that YouTube is able to react to something as small as an XKCD comic, in order to deliver new features?
No, programming is an ongoing expense. So you want to develop in something maintainable, and in something that can scale, even if you can't scale yet.
Oh, and horizontal scaling is more important than vertical scaling, for pretty much all web apps. Vertical scalability is what you're assuming is important -- squeezing more out of every cycle of a single machine. Horizontal scaling is about making sure that you can simply throw more servers at the problem, and your app will actually be able to run concurrently on multiple cores, and on multiple machines, without falling over.
Also: Programmer time is never going to get cheaper. Hardware does all the time, thanks to Moore's law. Unless that trend stops, my position in this argument will only get stronger every year.
Don't thank God, thank a doctor!
Unreadable!
Spot on. Dead on target and a car analogy. You rock.
--MarkusQ
Could have pointed to a timecode. Seems to be about 19 and a half minutes in.
I wasn't wanting to start a flamewar of language vs language. I'll defend a lot of features of Ruby, and I'll point out fundamental flaws in it...
But I think we can agree that web services should almost never be written in C, when there's any higher-level option.
Don't thank God, thank a doctor!
They told me that is not such an great idea ....
http://marc.info/?t=122174931400009&r=1&w=2
and i agree that it will break things but it would make php more friendly to java script programmers
I don't know if they researched the solutions to this issue from other programming languges:python , perl , ruby , pascal
developer http://flamerobin.org
...but ist architects smoke REALLY good stuff.
QWERTZ representing from Germany, and I must say that it's not easy to type \ here:
On Windows machines, you type the right-hand side "Alt" and "?" for a \. If you're on a laptop without a right-hand side "Alt" key you're going to need documentation on how to get a \. With a bit of luck it's Function-Alt-?.
On Mac machines it's a lot easier: You type Alt-Shift-7, except where the \ symbol is very likely printed on your Windows keyboard, on Mac none of the Alt-combinations are.
On german HP UNIX keyboards it used to be worse than that, but maybe they've changed their layout now.
\ is a bad choice also because it is used as a quotation character in a LOT of languages.
This has to be a joke! Are the php people idiots ... people love and crave familiarity ... and where i am from "::" is a scope operator. Maybe the lazy buggers don't like lexing for two characters instead of one. Java suceeds because it is familiar, C# same, etc etc ... use your GD heads!
fuck the world!
oh my god! why not use comma , as namespace separator??!!
we can kill follow syntex: define('a', 'a'); define('b', 'b'); echo a,b;
and assign comma to namespace...
They have a serious consideration about character count for a two-character operator vs. a one-characters operator which will be used in a minority of lines of code? This is from the people who put entire APIs for a few dozen optional libraries in the global namespace in the first place rather than working out separate namespaces? This is the same language with the functions "mysql_real_quote", "mysql_query", "imagetruecolortopalette", "xsl_xsltprocessor_transform_to_xml", "htmlentities" and "html_entity_decode", right? They can't even decide how the the words in multi-word function names will be joined.
$876.58 adds up. Leasing four servers rather than six is negligible, but leasing 400 rather than 600 easily covers the salary and overhead for the guy who makes it possible.
<humour>
From the chatlog:
is there some problem with \ and notepad?
[...]
no there isn't
[...] [...] [...]
So \ it is.
No wonder why many prefer a snake, a gemstone, or a mollusk byproduct.
</humour>
They absolutely need to rename the language.
I suggest Beginner's All-purpose Scripted Internet Code, or "BASIC".
Either way, most languages use either "." or "::" for namespaces
That's cute, but unfortunately irrelevant. Both of those are already in use in PHP's syntax, and changing them would substantially break backwards compatibility. That is why they had to choose between the other unused characters.
Allowing unicode characters in identifiers is SICK and not to be encouraged by any programming language or any compiler for any reason, as the issues are even more widespread than with this PHP issue.
How anglocentric of you... One can easily see from your post that you never need anything outside of ASCII to properly spell any word you would sensibly use as a variable name; that puts you in a very small minority.
Seriously: what issues are you referring to?
I can relate to both sides of this issue, personally... I mostly speak English myself but when it comes to computer languages, I would ideally like any I design to have good potential for international appeal without forcing foreign programmers to do things like use programming constructs with English names or ASCII symbols...
But the issues to which he refers, I believe, have to do with the various ways certain glyphs can be encoded in Unicode - for instance, as a letter plus an accent mark, versus a pre-composed version of the letter with the accent mark (as a single code-point)... Handling cases like that (which are basically invisible to the user) requires more aggressive Unicode processing in the language interpreter. I think there's other, similar cases as well. And then there's the problem of making sure that characters that should not be valid parts of a symbol name are not - for instance, each language's equivalent of the quoting characters, different Unicode variants of the mathematical operators, etc...
Basically, allowing the full range of Unicode to be used in identifiers raises the standard of complexity for handling the computer language significantly - and doing so is only moderately worthwhile, IMO, if it's not one's intention to move forward with properly internationalizing the language itself. (For instance, should a word in katakana be equivalent to the same word in hiragana? Should the antiquated version of a Chinese glyph be considered equivalent to the modern variant? And if different natural languages have different rules for what Unicode code points are "equivalent", how do you deal with that?)
Finally, there's the problem of characters that look identical, but aren't. For instance, certain Greek or Cyrillic characters that look the same as particular Roman characters, but are in fact distinct in Unicode. (This is less of a practical problem, though, and more a new way to obfuscate code...)
The problem is similar to the problem of handling caps-insensitive name matching, and with similar implications, but on a much larger scale. (Basically, you would attempt to translate the input to some canonical form for matching - but keep the original version around for debugging purposes, etc.) It's a substantial challenge, and to some extent meeting that challenge doesn't really make the language better...
*Yawn*
As usual a bunch of people who never use PHP complain about a bunch of nonsense like: function argument order, the language has its own syntax, it has a "bloated" core (oh no! a 4mb executable shared across all php threads on my web server, THE HORROR), bothering to maintain backwards compatibility instead of breaking millions of apps and preventing them from upgrading to receive bugfixes, etc.
:: and . are both already used in PHP. Breaking backwards compatibility is bad. Unless you expect to copy-paste code from some other language into PHP, there's no reason it needs to copy Your Favorite Language(tm)'s syntax. People who actually code in PHP will use it, recognize it, etc.
And despite all the perl mongers with sour grapes, PHP will keep being the most widely used web programming language, with python and ruby as distant seconds.
And for good reason too. Bad programmers (and noobs) can use PHP badly but still get things done. Good programmers can make large scalable web apps Very Quickly and with all the language features they need.
How is it possible for even American developers to be this clueless. Which characters are convenient to type depends entirely on the keyboard layout that is used. Case in point, $ is insanely painful to type on Scandinavian layout.
I hate issues like this. I want to create a Unix Shell-ish language - which means one of the very first design decisions is that $ prefix is used for variable names... But I hate the idea that the language I want to create could be a pain in the ass for people in other countries!* I'm not entirely sure how to solve issues like this, since there's a limited number of syntax characters available for use, and I don't want to define a whole bunch of reserved keywords... (My best plan to deal with this, so far, involves allowing for the definition of equivalent syntax characters for other natural languages, and also making the regular ASCII versions I'll be using easy to input regardless of the keyboard layout of the user, in interactive sessions anyway...)
But the choice of syntax characters, to some extent, must be guided by how that affects the complexity of the parsing process. There are a number of reasons for this. Obviously the language interpreter itself has to be able to interpret the language - but also it is generally helpful if it's relatively easy for ancillary utilities (editors, IDE systems, debuggers, etc.) to handle the syntax... And with things like PHP where the source code gets interpreted over and over again each time a page is loaded, for practical reasons it's best if parsing is fast...)
(* Obligatory joke: If the design pans out, it'll be a pain in the ass for everyone, regardless of nationality. :D )
Bow-ties are cool.
Will the people who made PHP a good programming language please fork it and take it away from the clueless morons who have taken over?
As a Perl programmer, I have to laugh at your suggestion that somebody ever made PHP a good programming language. Read this and this.
It's good that there's a programming language out there that Perl Programmers can laugh at...
Bow-ties are cool.
Not being able to build a car by themselves doesn't make people unable to tell that a BMW is better than a Yugo.
There are languages like perl where you can name your loops, to make it clear where you want to break to:
OUTER:
foreach my $i (@x_vals) {
foreach my $j (@y_vals) {
next OUTER if out_of_bounds( $i, $j );
process( $i, $j );
}
}
And in using subroutine calls inside of loops there's a tradeoff between readability and efficiency. You can't say dogmatically that one way is better than the other.
But it did all this without namespaces. Aren't you annoyed at them changing part of their winning formula?
But you know, half of the time when I try to use one of these wonderful PHP based web apps, I discover remarkable amounts of suckage. I use a Drupal-based events blog that gets confused about days and times. Once, I set someone up with a Horde/IMP webmail account, and it turned out to have a nasty, clunky UI, and the proper administration was too difficult for the ISP (mysterious errors about incompatible versions of something or other kept popping up, as I remember it).
PHP programmers discovered the "worse is better" principle, and took it to extremes.
It could be that the success of PHP goes very far to proving that "Languages Don't Matter" -- at the very least, you can compensate for flaws with coding standards, automated tests, and fanatic QA, or else Yahoo would be out of business.
$876.58 adds up.
...to less than one developer's salary.
leasing 400 rather than 600 easily covers the salary and overhead for the guy who makes it possible.
Assuming that, at that stage, only one guy would be enough to make it possible.
Now, granted, one guy probably could, by tweaking some algorithms, adding caching in just the right places, etc.
But one guy is not the difference between, say, a Ruby team and a C team.
Don't thank God, thank a doctor!
Been a programmer for quite some time now, mainly used PHP. Was happy when PHP added support -finally- for namespaces, but this separator is ridiculous! Can't really say more about this..
Granted, and apologies
Yes it is. The numbers add up. As another poster mentioned, enough extra cpu's for 24 hours a day does add up to your salary.
Ok, programming is an ongoing expense. But do notice that hardware and maintainance of said hardware is an ongoing expense as well. You need to balance the two. Not being able to scale yet means that you cannot scale. The product is unfinished.
I didn't claim anything around horizontal or vertical scaling. You're assuming I'm talking about wasting cycles here, but I'm not. I am talking about proper design for scaling, as well as proper coding to make use of that scaling. Both of these take time and thought. In my experience, a team that does not take excellent care of the details of their code to make sure that the individual components run smoothly and fast is very likely to make some large errors in their design to prevent them from scaling properly. One such error for a web application is building a CRUD application with dependence on a separate relational database tier to maintain state. This creates highly maintainable and easy to comprehend code that will not scale horizontally without some drastic measures. This is about 90% of the web-apps right there, and armies upon armies of DBA's and IT personel are full-time employed to keep such applications somewhat performing. This is considered best practice in the field and Oracle is laughing all the way to the bank.
Finally, you mention Google. Have you ever looked at the attention to detail that comes out of Google in their high-scalability code. The web-parser is in C, simply because that's the fastest way to parse html. They might have a million machines to do this, but they do want to finish the job of parsing the internet as quickly as possible, simply because that means you can do it more often with the same hardware.
Their generated html has all unnecessary fluff such as extraneuous whitespace removed, simply because every byte counts over the network. The generated javascript: no extra whitespace, and with short variable names. Same reason.
There's no app-server involved, no database dependency in the response cycle, they've developed their own file-system, tuned their own fork of the OS to perfection, developed their own frameworks for using their hardware, etc., etc., etc. Google is by far the best example of my point: they have not offloaded any programmer's work on the maintenance staff. The programmers create code to do the job from the high-level scalability design down to the low-level optimizations that make it run smoothly in practice. The maintenance staff takes care of the hardware, and doesn't have the additional burden of covering for slack on the side of the developers. If you take care of detail, you can provide higher quality code, smoother operations, and overall a lower total cost of developing and running your app.