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
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
[sic]
The World Wide Web is dying. Soon, we shall have only the Internet.
PHP uses the . as the concatenation operator. PHP does not support operator overloading...
Username taken, please choose another one.
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
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.)
It's not just developers, it's things like IDEs which highlight anything starting with '\' as an escape sequence.
Which - since nearly every other common programming or scripting language uses '\' to mark the beginning of an escape sequence - is something you might reasonably expect.
Come to think of it, so does PHP... ooops...
Il n'y a pas de Planet B.
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).
There are lots of valid reasons for hating any given language, but syntax is rarely one of them. (Lisp excepted)
I am TheRaven on Soylent News
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.
This isn't the first (or last) time PHP developers have implemented a stupid workaround rather than fixing problems with the language/runtime/interpreter/parser/scanner.
Do you even lift?
These aren't the 'roids you're looking for.
You could write your web application in C++ but I'm not sure if anyone other than you would be able to understand it in 5 years... :)
LOAD "SIG",8,1
LOADING...
READY.
RUN
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.
PHP uses the . as the concatenation operator. PHP does not support operator overloading...
You don't need operator overloading. To use the same symbol in different contexts.
You need a parser worth its salt.
a.one = $b.two . $a.one
Only has one use of the concatenation operator if 'a' and 'b' are namespaces.
A good convention is to simply require space around the concatenation operator. Or to require both operands meet the lexical conventions of a variable or string constant, for it to be interpreted as a concatenation.
I.e. $X = $A . $B
Is a concatenation
$X = $A.$B
Is a parse error
$X = $A.B
Is an assignment of 'X' to the 'B' variable within the 'A' namespace
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.
You mean "language\runtime\interpreter\parser\scanner".
Yeah, you don't need insight to know the developers were high as a kite.
The whole purpose behind using '.' as string concatenation instead of '+' is that it eliminates ambiguity. What you're suggesting throws the ambiguity back in. Remember, if it's more complex for the parser to understand, it's more complex for a human to understand. As a programmer who moves between PHP and Javascript a lot, I can tell you that I miss being able to use a dot for objects when I'm in PHP, but the ambiguity in string concatenation/addition in javascript is an order of magnitude more annoying.
I suspect they're doing the same thing with namespaces. The backslash isn't used for anything except escaping strings, and I doubt that's going to add any ambiguity at all. There are a lot of problems with PHP, and it's well worth your ridicule, but making sure that separate operations have separate operators isn't one of those problems.
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.
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?
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.
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.
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();
The backslash isn't used for anything except escaping strings, and I doubt that's going to add any ambiguity at all.
Oh?
What's this going to mean?
namespace X;
class n{
}
$X\n->r = "B";
Then later....
$X="S";
echo "$X\nn->r\n";
Doing string interpolation unambiguously will be a PITA, since \ has special meaning inside a string.
Does the "\n" delinate the end of the identifier and a carriage return, or is it being used as a namespace separator?
I don't think they're making parsing all that easy.
At least with lexical rules and a . operator, things can be well-defined, and not break other features of the language.
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.
As I remember, everything more complex than just outputting the value of the variable (ie calling a method, accessing a property, etc) requires you to use brackets inside of the string. Namespaces would work the same way without adding any complexity that wasn't already there.
Syntax is perfectly good grounds for hating a language.
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".
Can you *please* stop spreading this anti-Perl FUD?
Perl5 is neither the unmaintainable mess that Perl4 was, nor is it "dead" because Perl6 is being worked on. Considering the important things about a HLL (maturity, library quantity and quality, expressiveness), Perl5 continues to be one of best options out there.
-- The act of censorship is always worse than whatever is being censored. Always.
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.
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}}
Oh please.
When I write this:
function foo() {}
it highlights the word "function" in blue.
Somehow, miraculously, when I type:
$x = "function foo() {}";
The IDE knows that this isn't a function declaration. And, lo and behold, so does the PHP interpreter.
Now tell me why you think an IDE will have trouble differentiating:
$x = 'this isn\'t hard';
and
$x = myNamepace\myClass::myFunction();
That's actually one thing D got right - using binary "~" for string and array concatenation was both new for a curly-braces family language, not easy to confuse (unary "~" is not used that often), and has a mnemonic definition (it's called the "rope", and ties strings together).
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.
Perl suffers from first mover syndrome. It was drawing upon many established Unix conventions, most of which were unreasonably parsimonious with syntax, though one's definition of "unreasonable" changes in a big hurry coding over a 2400bps dial-up terminal.
PHP's approach was to hit the sweet spot on inception, deal with the short-sightedness later. They managed to bind the design variable "now" to web coding practices circa 1997. I don't think the exorcist exists who can expel that legacy.
I don't actually mind PHP all that much when I'm slumming, and let's not forgot a scalable application or two has been successfully coded in the language, e.g. MediaWiki, which does not have the reputation of being a cesspool of security oversights.
Late 1996, Internet Explorer ships with VBScript enabled. Standards of sanity were pretty subjective for a couple of years as the internet entered the wormhole. At that point in time, PHP would have received a AAA credit rating, no questions asked.
It's not clear to me that if PHP sucks because is was designed too quickly, that Perl6 will also suck because it is being designed too slowly. I missed a step there in the inference chain. Larry Wall has lived through the language fads since Kieth Richards starred in 22 grams.
Lest we forget, the same meme of "after so long, it will suck anyway" was widely applied to Postgres and Firefox and to a certain degree, Debian Sarge.
I'm actually kind of interested to see how a language designed by a war vet turns out.
Meanwhile, I thought I would learn some Lua, but then it turns out that Lua requires a heap, which I can't justify and don't wish to incorporate into my embedded project design.
<?
class Q{
};
$Q->n="B";
echo "$Q->n\nS";
echo "$Q$Q+$Q\nX->n\n";
?>
And the output in PHP 4.4.8 (version of PHP distributed in stable OSes) is:
B
SObjectObject+Object
X->n
Just like one would expect....
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:
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.
Well you could avoid using a variable inside a string since that gives ambiguity already. It's a feature that helps in simple cases that would be simple enough to do without it but complicates too much big projects. Just concatenate them with that fancy operator . everyone is talking about.
ics
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.
...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;
Use of that fancy concat operator . makes things less readable.
Sorry... echo "Hello, $name, I am a fancy computer. How is $othername ?\n";
Is much simpler, clearer, and more convenient to write than echo "Hello, " . $name . "I am a fancy computer. How is " . $othername . " ?\n";
And avoiding the useful feature (string interpolation) still doesn't resolve ambiguities that are created when other programmers already have or will use string interpolation.
String variable interpolation is a convenient feature PHP has taken from perl and the shell.
And its availability and similarities to perl and the shell is part of what has made PHP so popular.
So to make it not work in a consistent convenient way at this point that doesn't break other programs would be unfathomable.
And by the way, using ${} brackets is inconvenient.
It seems pretty clear that use of \ as namespace separator is a mistake. There are better choices like ':' which are even more proven for use in C-like languages.
PHP is reinventing the wheel, but they're making this one square.
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.
It's difficult to design complicated software in Perl.
Hogwash. You just have to self-impose some rules, since Perl doesn't impose them for you.
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).
Go ahead and ignore Perl 6 for now; I am. Perl 5 is still being actively developed; they're not making major announcements like "OMG we've invented namespaces!" because Perl 5 is already a perfectly adequate language. Perl isn't a hot new buzzword, but that doesn't mean it's dead.
$x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
$x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
Download a minor update to your IDE, and you should be fine.
$x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
$x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
'**' is easier to type than '^^'?
It is, once you consider some people have dead keys. Typing "^^" can become wildly different depending on what OS you're using, and result in weird behavior. On some systems/applications, the two carets are printed at once and you're back to normal editing. On others, the first one is written, but the other remains in dead-key mode. I've seen systems where this would just print a single caret (possibly coupled with a beep). Then the only reliable way on those keyboard layouts to type that symbol is to press caret, space, caret, space -- four key presses (not counting any shifting you might need to get to the caret character) for an operation which might become very common.
Using '\' has the best parse-ability?
Well, an unambiguous, single-character token is often easier to parse than a double-character token which might conflict with a single-character one.
Plus they did not even evaluate '::'.
That's what they were originally using. The problem is that they already use it for static method invocation, so there would be problems when class names and namespaces clashed. And then for some reason they decided they wanted to allow that to happen, rather than (for example) not allowing classes to have the same name as namespaces and mitigating that by using different naming conventions for both.
But then again, the backslash isn't very easy to type either -- I'm daily switching between three different computers. On each one of them, the backslash key is in a different position. Seriously.
:: is already used for static methods on classes... it would be harder to implement the differentiation of :: for namespaces and :: for static methods... especially if people started to use classes with the same name as a namespace (which is likely if all modules get their own namespace)
I actually think that '\' is appealing for what it will be used for. The one thing I first though of was SomeModule\new_object::test_function();
Wouldn't it try to evaluate the '\n' as a \n new line? I suppose it will be out of the double quite string scope so it could be alright... could get messy if eval()-ing code, though.
It is more readable from a non-programming point of view. But if you are searching for a bug in your script then having everything modularized and atomized as much as possible can help you spot the problem. If on the other hand you have to question simple syntax your search is going to be slower.
ics
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*
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.
'**' is easier to type than '^^'?
It is, once you consider some people have dead keys. Typing "^^" can become wildly different depending on what OS you're using, and result in weird behavior.
Yes but we are talking about a very, very slim minority here are we not? No offense intended but it seems like your whole point is hinging on the absolute minority of people out there. I can't think of any systems off hand that do this
Using '\' has the best parse-ability?
Well, an unambiguous, single-character token is often easier to parse than a double-character token which might conflict with a single-character one.
I will give you that
But then again, the backslash isn't very easy to type either -- I'm daily switching between three different computers. On each one of them, the backslash key is in a different position. Seriously.
So spend the $5 and get a new keyboard? Unless your keyboard is physically, permanently attached. Then again we get into the very, very minority. This argument seems to me alot like that coming from people that are STILL using IE6: Me: Why don't you upgrade? Them: Upgrading is too hard Me: You mean hitting a single button (yes install an update) and waiting for a few minutes is too hard? And because you are too lazy to update we have to go out of our way to be backwards compatible...
Yes but we are talking about a very, very slim minority here are we not? No offense intended but it seems like your whole point is hinging on the absolute minority of people out there. I can't think of any systems off hand that do this
According to Wikipedia, the circumflex accent is "used in written Croatian, Esperanto, French, Frisian, Norwegian, Romanian, Slovak, Vietnamese, Romanized Japanese, Romanized Persian, Welsh, Portuguese, Italian, Afrikaans, Turkish and other languages".
I don't know the keyboard layouts used by all of them, but I'd bet most (if not all) of them use a dead key for both the caret and the circumflex rather than including additional keys, and Portuguese and French have a reasonable number of speakers. Plus there are those who, despite not speaking one of these languages, still have dead keys (for example on US-International). What's the layout used by the people who speak Spanish in the US? If it's US-International, that should be a sizable part of the population even in an English-speaking country.
So spend the $5 and get a new keyboard?
Um, no, not always possible. I know this comment went more into my particular problems, but still I saw similar complaints on Reddit. I guess people in other countries also have the same issues of every now and then having to deal with other layouts.
Yeah? By string constant, I assume you mean string literal? But you can also concatenate numeric literals. And class constants. And regular constants.
And by the time you've got those cases, ($a.two . $a.one) is ambiguous, regardless of how good your parser is. Oh, unless you want to make whitespace around operators meaningful, which is, frankly, horrible.
=w=
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.
Things like regular expressions are stupidly annoying to use (compare to Perl or Lua+LPeg).
Huh? Perl uses regular expressions extensively, and many other languages have adopted Perl's regular expressions.
I'm sorry you don't "get" regular expressions, but they are probably the biggest success story of text processing ever: powerful, concise, efficient, and theoretically well understood. They are also a fundamental part of computer science.
but then it turns out that Lua requires a heap, which I can't justify and don't wish to incorporate into my embedded project design.
You want a high level language that doesn't use a heap? That's going to be a little hard to come by. I've used Lua, and I have to say it's very memory efficient. The newest version even has an incremental garbage collector so you don't get long pauses while it runs. Sure, it uses more memory than C or assembler, but it's totally worth the extra memory. You can even strip out the compiler and just leave the bytecode interpreter.
Dude, who is using regular expressions these days? "Oh, we have a problem and we can use regexp to fix it!" â" well, now they do have two problems. I do not have any problems with text processing and especially web, using Python. If you use XML, then probably Python or Ruby or Groovy are the only best choices among scripting languages.
Perl?.. Hahahaha!..
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!
And this is (one of) the many reasons PHP sucks:
Java:
Attribute/Method access: foo.bar
Static method access: Foo.bar
Package access: foo.bar.baz
C#:
Attribute/Method access: foo.bar
Static method access: Foo.bar
Namespace access: foo.bar.baz
Python:
Attribute/Method access: foo.bar
Static method access: Foo.bar
Module access: foo.bar.baz
PHP:
Attribute/Method access: $foo->bar
Static method access: Foo::bar
Namespace access: foo\bar\baz
But... the future refused to change.
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!
Unless your XML contains Unicode....
how to invest, a novice's guide
. as the concatenation is bone stupid, but is a result of other bone stupid decisions in PHP. The trouble is that PHP automatically coerces your results into other types, which results in craziness like "false" == 0 being true; if + were the concatenation operator, PHP wouldn't be able to tell whether to do string concatenation or addition.
Part of the fault allows rests with the unbelievably dreadful parser in the language, written completely ad hoc. If you want to see a bad parser, if you want to see really bad code in general, look at the PHP parser.
What makes e.g. Python good is a series of excellent decisions which make later decisions easier. What makes PHP execrable, terrible, dreadful, is a series of poor decisions at the beginning and a refusal to admit or realize them or correct for them.
I think the \ as namespace is a great idea as I think PHP should go away and this will hasten its inevitable though prolonged death.
Honestly, that problem is largely avoided by having an editor that does decent syntax highlighting. I find myself bouncing between them all the time, it really depends what I'm doing. More often than not, I'll use whichever approach allows the least escaping of quotes, since the backslashes all over the place IMO make for even worse readability than the concatenated strings.
Then again, I'm also doing my best to avoid all of the random mixing of languages that everyone does when first starting out with PHP (echoing HTML as part of a script as compared to having a standard HTML page with little bits of <?php echo $inlineVar; ?> as needed. Chances are that most people that know enough about coding to actually use namespaces (read: not most PHP coders) are doing the same. Having said that, I still think the originally-intended double-colon namespace separator would make more sense with the existing OO syntax in place. Or I do five minutes after reading the summary; the more clearly-declared intentions that using a backslash will bring will probably grow on me, even if I'm not a big fan of paying homage to old DOS folders.
How are sites slashdotted when nobody reads TFAs?
Epic failure. An ambiguous example is even linked in the summary. For starters it causes tremendous confusion in reflection; for instance if you have a namespace Foo containing a class tBar, then a string reference written 'Foo\tBar' or "Foo\\tBar" is correct, whereas "Foo\tBar" is an error as the double-quotes cause a tab character to be escaped. How awful is that?
And why would you be echoing a namespace anyways? You'll do your "use net\firehed\something as shortname;" and be done with it If you're insistent on not using 'use' then you'll wrap the whole thing in curly braces like you would for almost any other OO vars (echo "I've got a few words for you, {name\space\$user->name['first']}."; I would think).
How are sites slashdotted when nobody reads TFAs?
And by the time you've got those cases, ($a.two . $a.one) is ambiguous, regardless of how good your parser is. Oh, unless you want to make whitespace around operators meaningful, which is, frankly, horrible.
Yes, I do. It's not so bad, PHP already does it.
Have you ever tried $X - > member (where $X is an instantiated class object?)
You can't do it. it's a "->" operator, not a "- >" operator, just like A.B would be a namespace member operator.
In that case, you can say that since "a" is the name of a known namespace, the dot that follows cannot be concatenation, because a namespace name followed by a dot is simply disallowed.
From a semantic point of view... there really was no ambiguity, provided you introduce the rule that once a namespace has been declared, the same name may not be used for a variable, class, or constant.
Just make sure your namespace names are memorable, distinctive, and you're good to go.
Unless your XML contains Unicode....
All XML is in unicode. What's wrong with Unicode anyways? It works for years to everybody.
That's not whitespace around operators. That's replacing one operator with two (minus and greater than). Of course that'll make a difference, but my point was that whitespace around the operator currently doesn't and shouldn't in the future. Don't misconstrue it. To be clear, the reason meaningless whitespace around operators is is that both of the following work the same way:
Now, though, you're proposing that namespaces shouldn't be allowed to have the same name as any variable, class or constant. Are you mad? You realise that name conflict resolution is what namespaces are for, right? Yet you want to make it the case that if I'm using a Date namespace, I can never have a variable or class called date/Date? That's crazy.
The "just make sure your names are memorable, distinctive, and you're good to go" rule is what PHP currently has, with class names for instance. And it's the problem that namespaces are designed to solve, not make worse.
=w=
Variable-width encodings are what's wrong with Unicode, but I meant that current stable versions of Ruby do not handle Unicode well, and I believe that Unicode handling in Python 2.x is suboptimal. (I haven't used Unicode in Python 2.x, and I understand that Python 3 is much better in that regard.)
how to invest, a novice's guide
Ruby's Unicode (and not only this) sucks, yes. Well, to be honest, I said about Ruby more like to be nice to Ruby community. :-) But in fact, there are no problems handling Unicode in Python at all. I am doing it like 7+ years so far. Syntax could be better though, but it works rock stable and reliable. Besides, I am Unicode-freak and believe that other encodings must disappear (not yet for SHIFT-JIS though, because Japanese gov is too slow in this), but still I think I know what I am talking about. :-)
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.
...um, what exactly is the point you're trying to make? That PHP sucks because it isn't C#, Java, or Python? Languages do have different syntax. Deal with it.
PHP sucks because it's poorly designed, encourages bad programming practice, and makes good programming practice difficult. The syntax, however, isn't particularly out of the ordinary.
(I do agree that \ is a very bad choice, though. The keyboard I'm typing this on doesn't even have a backslash key -- I have a choice of Fn-Z or Compose-/-/, neither of which is very easy to type. Thankfully I don't use PHP, so the problem won't arise.)
"People with laptops" is a very, very tiny minority?
If you live anywhere on continental Europe "\" is not an easy character to type.
On French, German, Swiss, Belgian keyboard the little b*st*d is an "alt gr" key.
Not too much of a problem until you have someone on the phone. Just try holding down the "Alt Gr" and
the "" key at the same time as holding a telephone receiver!
Curse you insensative anglo saxons!
Old COBOL programmers never die. They just code in C.
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.
That post does show quite well what a silly decision it is. Standardise. Change a few things at a major revision to make stuff logical, well thought out. I can't see the logic to this decision at all.
Get your own free personal location tracker
Ok, I should have been more explicit. My complaint is that there isn't a good reason for using three diferent syntax where one would have been enough nor there is a good reason to use "$" only for variables but not on classes or namespaces.
I know, it allows us to have a variable, a class and a namespace with the same name but we don't really do that anyway, we use different naming conventions, etc.
But... the future refused to change.
$X = $A.$B Is a parse error
Nope, it's taking the value of the variable who's name is stored in $B out of the $A namespace. Also, lots of code already uses "string"."another string" (no space between) for concatenation -- with . being used for namespaces, this would try and fetch the variable named "another string" from the "string" namespace...
I mod down anyone who says "I will be modded down for this", regardless of the rest of their comment
No, '.' is used because PHP is weakly typed. Whether to add or concatenate HAS to be specified by the programmer because unlike in strongly-typed languages (e.g. Java), there's no way for the interpreter to know which you want.
Which is epic fail on the part of PHP - look at Python for comparison: >>> 'foo''bar' 'foobar' >>> 'foo'+'bar' 'foobar' >>> 3 + 5 8 To a Python guy, PHP looks more like an ad-hoc collection of hacks than a true programming language.
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!
Plus they did not even evaluate '::'
For better or worse, they couldn't. In PHP, the '::' token is already reserved for derefencing the members of a static class.
Come on, everybody. There's no shortage of legitimate reasons to ridicule PHP, but "doesn't use all the same punctuation as a few other programming languages" isn't one of them.
> ...if it's more complex for the parser to understand, it's more complex for a human to understand
Really? As example in C++: "vector<vector<int>> x". Easy to understaind, hell to parse. Or in scheme: "((foo (baz)) foo)"; easy to parse, hell to understaind ...at least to untrained brain and eyes ;)
"People with laptops" is a very, very tiny minority?
People with laptops typically have a removable keyboard
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.
"$" is used on an instance of a class.
As in:
$user = new userClass;
$user->load($_REQUEST['id']);
echo "Hello " . $user->firstName;
(yes, I'm passing a raw form request to what is probably a database. Before someone bitches about how bad PHP programmers are, let me assure you that this imaginary class contains automatic, imaginary input verification and scrubbing, and will turn control over to an imaginary error-handling class in the event of a hypothetical datatype mismatch on an integer SQL row ID)
It's not typically intended to be removed by the user, so it's not easy to remove. Besides, even if it is easily removable (which it usually isn't), it's usually not something for which you would just pop down to Fry's, pick up a random keyboard, and drop it in...a given notebook keyboard will usually fit only a small handful of different models.
20 January 2017: the End of an Error.
PHP:
Attribute/Method access: $foo->bar
Static method access: Foo::bar
Namespace access: foo\bar\baz
To be fair, C++ is pretty stupid about this, too. Not quite as stupid, but that's clearly where they're drawing the inspiration for the first two cases.
"$" is used on an instance of a class.
I know that, but that "$" is still superfluous the same could be achieved by writing:
user = new UserClass;
user->load(_REQUEST['id']);
echo "Hello {user->firstName}";
Oh and interpolation makes a dedicated concatenation operator irrelevant but I'm not complaining about that.
But... the future refused to change.
<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>
Set "magic_namespaces" on to use a dot. Done and done.
I just started some PHP forms and learned that PDOException doesn't inherit from Exception, and most errors don't throw exceptions anyways, so error handling is really bad. It's common to see PHP database errors, but I always thought it was lazy programmers.
tomorrow who's gonna fuss
They absolutely need to rename the language.
I suggest Beginner's All-purpose Scripted Internet Code, or "BASIC".
It means that you should use single quoted strings.
Fanatically anti-fanatical
*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.
javascript is an order of magnitude more annoying.
Is there *anything* you can do in javascript that isn't an order of magnitude more annoying than doing the same thing in [insert language]?
Honestly, I'd rather not use a compiler/interpreter written by someone who cannot grok the "complexity" of handling unicode properly.
In the same vein, designers of caps-insensitive languages should be banned from using computers, so that's not really an issue...
More seriously: there are quite a few languages which allow Unicode everywhere, and the implementors have not died in the process of getting that done right...
Google has never heard of magic_namespaces what are those?.
But... the future refused to change.
According to Wikipedia, the circumflex accent is "used in written Croatian, Esperanto, French, Frisian, Norwegian, Romanian, Slovak, Vietnamese, Romanized Japanese, Romanized Persian, Welsh, Portuguese, Italian, Afrikaans, Turkish and other languages".
I don't know the keyboard layouts used by all of them, but I'd bet most (if not all) of them use a dead key for both the caret and the circumflex rather than including additional keys, and Portuguese and French have a reasonable number of speakers.
On a Norwegian keyboard hitting the caret one time gives you a dead key, the second time it gives you two carets. As does all the other dead keys.
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.
No, they probably can't. Mindless recitation is how they prove their intelligence.
If anyone here happens to like obnoxious jokes, try: "Perl6 is a scheme for turning Perl5 into a sane language by keeping Larry and Damien busy with something else."
Anyway, yeah, the perl 5.10 release had some interesting new features, and CPAN activity is running higher than it was during perl's supposed hey day. Perl's death has been greatly exaggerated.
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.
I can agree with that. The '+' is additiion -and- space in urlencoded strings. I would really like to see php start being consistent with their function naming. str_replace, strlen, strtolower ... they need to fix that shit!
Agreed on the function naming. I don't find it nearly as bothersome as syntax issues, however.
$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!
Funny thing is, mine's got two, one next to the spacebar, one next to enter. This is on an old FSC AMILO L1300, and its the same on my new Pi 2530. I think one of those is a legacy key that got reused, and they think they can out it wherever they want.
I know tobacco is bad for you, so I smoke weed with crack.
What I'd like to know is how to change the keyboard on a laptop without shelling out a ton o' $$$ and/or voiding your warranty. Any takers?
I know tobacco is bad for you, so I smoke weed with crack.
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.