Thomas 'PointedEars' Lahn escreveu:
VK said:
Matt said:
I would much rather use a well developed library than write my own so I can
concentrate on the, I hope, original stuff.[...]
Then another must in your collection should be "prototype.js" library
<
http://prototype.conio.net/>
No, it should not. But I am not surprised that you recommend it.
I took a look on this code one month ago and I didn't liked too, the
guy prototyped even the Object, which killed the "for..in" loop.
In my opinion most of those functions just complicates what was so
supposed to be very easy... Some of them are handy, but since he's
writing a library that's used by a lot of people, he should write
better things and for sure avoid global objects, anyway, it's not my
problem ;]
It is based on how many times my shortcut function $(id) for
document.getElementById had clinched in someone's environment (because
prototype.js has it's own of the same kind).
I also had problems with this Prototype library, but it was due to the
"for..in" death, I sent an email to the creator and he said that was
going to correct.
Actually the absence of package namespaces is a killer in JavaScript.
But you can create your namespaces, it won't avoid such problems, but
if you choose a nice name the chances of breaking your code will really
decrease, and if it get overwritten by another developer, at least it
will be easier for you to find the problem as nothing will work
JonasStuffs = {
a: function(){},
b: 123
};
You can even make something in a java style haha:
com = {jonasraoni: {etc: {
a: function(){},
b: 123
}}};
Sure it doesn't need to look so ugly...