

Apple JavaScript Coding Guidelines [pdf] - tbassetto
http://developer.apple.com/library/mac/documentation/ScriptingAutomation/Conceptual/JSCodingGuide/JSCodingGuide.pdf

======
omgtehlion
> Just as you used the new

> operator to create an object, you should delete objects when you are
> finished withthem, like this:

> delete myObjectVariable;

What a bunch of crap? Have these guys even looked at the specs?

And chapter on inheritance really makes me cry...

------
Tomek_
Already discussed in <http://news.ycombinator.com/item?id=1854783> with the
same consensus, it's a terrible guide. Read Crockford, Stoyanov, Bolin
instead.

------
Aqua_Geek
For those who would prefer an HTML version:
[http://developer.apple.com/library/mac/#documentation/Script...](http://developer.apple.com/library/mac/#documentation/ScriptingAutomation/Conceptual/JSCodingGuide/Introduction/Introduction.html)

~~~
scrod
Or the actual PDF itself, which lacks the Scribd™ value-added feature of
banner ads on every page:

[http://developer.apple.com/library/mac/documentation/Scripti...](http://developer.apple.com/library/mac/documentation/ScriptingAutomation/Conceptual/JSCodingGuide/JSCodingGuide.pdf)

~~~
superchink
I think the OP's link is actually to the PDF. HN adds the automatic Scribd
link whenever someone posts a link to a PDF.

~~~
scrod
Wow, that's horrible.

~~~
superchink
The original announcement (2008):

[http://www.scribd.com/doc/50406482/Hacker-News-Integrates-
Wi...](http://www.scribd.com/doc/50406482/Hacker-News-Integrates-With-iPaper-
Scribd-Blog-3-11-08)

------
lucaswoj
I have a _strong_ reason to suspect that this was written by an intern who was
relatively new to the language. It seems to be written by someone in the
C/C++/Java mindset (ie how they didn't list "function" as a primitive data
type)

~~~
jarek-foksa
Function is not a separate data type in JavaScript, but they could probably
list Object there (EcmaScript defines 6 types and 5 primitive values, I can't
really find any definition of "primitive type")

------
foobarbazoo
Man, what a piece of shit. Apple should pull this immediately.

~~~
yalogin
Good that I saw this before reading the pdf. Can you point me to a better
resource?

~~~
adolph
As seen elsewhere in the comments, Crockford's is very good:

<http://javascript.crockford.com/code.html>

------
lucaswoj
The example in this document of using the delete operator on a function is
wrong.

<http://perfectionkills.com/understanding-delete/>

------
Hovertruck
I find it strange that the "Global Scope Considerations" section uses Ruby-
style inline comments (#) rather than actual JS inline comments (//).

~~~
coyul
I find it strange that you refer to comments starting with # as Ruby-style
comments.

~~~
chc
I'm pretty sure Ruby is bigger than Perl and sh put together now, at least in
mindshare.

~~~
mark_story
python and PHP also support # for making comments. It could be argued that
python has just as much if not more mindshare than ruby. :)

~~~
chc
I agree. I think "Python-style comments" would be just as reasonable a term.
My impression was that the comment I was responding to was objecting on
historical grounds, since Ruby and Python borrowed that comment style from
Perl, which in turn borrowed it from shell scripts.

------
kreek
Most of the examples use C style curly braces, maybe Crockford needs to do an
"Apple Tech Talk".

<http://www.youtube.com/watch?v=hQVTIJBZook>

~~~
Apocryphon
Or just read this? <http://javascript.crockford.com/code.html>

I guess Crockford is like K&R for JS's conventions.

------
blahpro
It’s shocking that this document refers to "classes". JavaScript doesn’t even
have classes.

~~~
encoderer
Why is this comment deprecated? He's absolutely right, if a little late to the
party. Shockingly bad document from Apple.

------
jmreid
Two years old?

