From b2ad010f74a40acfffe757d32d22a166db5dc6f2 Mon Sep 17 00:00:00 2001 From: mmentovai Date: Wed, 4 Aug 2010 17:43:38 +0000 Subject: [PATCH] Update JavaScript style guide to 2.3: - Clarify the semantics of @private and @protected, in particular how they differ from the expectations of users of C++ and Java. --- javascriptguide.xml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/javascriptguide.xml b/javascriptguide.xml index 293a758..2f839cd 100644 --- a/javascriptguide.xml +++ b/javascriptguide.xml @@ -3,7 +3,7 @@

- Revision 2.2 + Revision 2.3

@@ -995,10 +995,16 @@

@private properties are accessible to all code in the same file, plus all static methods and instance methods of that class - that "owns" the property, if the property belongs to a class.

+ that "owns" the property, if the property belongs to a class. They + cannot be accessed or overridden from a subclass in a different file.

@protected properties are accessible to all code in the same file, plus any static methods and instance methods of any subclass of a class that "owns" the property.

+

Note that these semantics differ from those of C++ and Java, in that + they grant private and protected access to all code in the same file, + not just in the same class or class hierarchy. Also, unlike in C++, + private properties cannot be overriden by a subclass. +

// File 1. @@ -3015,7 +3021,7 @@

- Revision 2.2 + Revision 2.3