<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Packages are actually namespaces in ActionScript 3</title>
	<atom:link href="http://joshblog.net/2009/05/13/packages-are-actually-namespaces-in-actionscript-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://joshblog.net/2009/05/13/packages-are-actually-namespaces-in-actionscript-3/</link>
	<description>Josh Tynjala explores Flash, Flex, and ActionScript.</description>
	<lastBuildDate>Sat, 31 Jul 2010 02:55:11 -0400</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: James Bond</title>
		<link>http://joshblog.net/2009/05/13/packages-are-actually-namespaces-in-actionscript-3/comment-page-1/#comment-74944</link>
		<dc:creator>James Bond</dc:creator>
		<pubDate>Fri, 23 Jul 2010 19:12:30 +0000</pubDate>
		<guid isPermaLink="false">http://joshblog.net/?p=611#comment-74944</guid>
		<description>Right -- I have experienced the same thing (can&#039;t synthesize the namespace or QName objects that getMemberNames returns).  There is one line in the docs that hints that the &quot;special&quot; namespace that is used to get at the private and otherwise inaccessible member variables is not utterable.  I&#039;m using this technique right now to do some object reference graph traversals, so it&#039;s highly beneficial in specific circumstances.</description>
		<content:encoded><![CDATA[<p>Right &#8212; I have experienced the same thing (can&#8217;t synthesize the namespace or QName objects that getMemberNames returns).  There is one line in the docs that hints that the &#8220;special&#8221; namespace that is used to get at the private and otherwise inaccessible member variables is not utterable.  I&#8217;m using this technique right now to do some object reference graph traversals, so it&#8217;s highly beneficial in specific circumstances.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Tynjala</title>
		<link>http://joshblog.net/2009/05/13/packages-are-actually-namespaces-in-actionscript-3/comment-page-1/#comment-74907</link>
		<dc:creator>Josh Tynjala</dc:creator>
		<pubDate>Thu, 22 Jul 2010 19:29:56 +0000</pubDate>
		<guid isPermaLink="false">http://joshblog.net/?p=611#comment-74907</guid>
		<description>James, I confirmed that the QName returned from flash.sampler.getMemberNames() can be used to access the value of a private variable. I am unable to construct my own QName, with the same uri and localName, that is able to do the same thing, even in the debug player and in the same running SWF. There&#039;s some magic in the one returned from getMemberNames().

The meaning of my original statement was that you can&#039;t access private members in a production environment. I&#039;m sorry for the confusion.</description>
		<content:encoded><![CDATA[<p>James, I confirmed that the QName returned from flash.sampler.getMemberNames() can be used to access the value of a private variable. I am unable to construct my own QName, with the same uri and localName, that is able to do the same thing, even in the debug player and in the same running SWF. There&#8217;s some magic in the one returned from getMemberNames().</p>
<p>The meaning of my original statement was that you can&#8217;t access private members in a production environment. I&#8217;m sorry for the confusion.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Bond</title>
		<link>http://joshblog.net/2009/05/13/packages-are-actually-namespaces-in-actionscript-3/comment-page-1/#comment-74904</link>
		<dc:creator>James Bond</dc:creator>
		<pubDate>Thu, 22 Jul 2010 16:31:44 +0000</pubDate>
		<guid isPermaLink="false">http://joshblog.net/?p=611#comment-74904</guid>
		<description>Josh, I think the statement that was made was that it was absolutely impossible to access private member variables outside of their defining class.  I have provided a counter example showing it is doable; obviously there must be some limitations to it for helping to ensure the integrity of the application once its deployed.  I have also described a means by which it can be accomplished.  Did you try using my method to access the member variables outside at all?</description>
		<content:encoded><![CDATA[<p>Josh, I think the statement that was made was that it was absolutely impossible to access private member variables outside of their defining class.  I have provided a counter example showing it is doable; obviously there must be some limitations to it for helping to ensure the integrity of the application once its deployed.  I have also described a means by which it can be accomplished.  Did you try using my method to access the member variables outside at all?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Tynjala</title>
		<link>http://joshblog.net/2009/05/13/packages-are-actually-namespaces-in-actionscript-3/comment-page-1/#comment-74711</link>
		<dc:creator>Josh Tynjala</dc:creator>
		<pubDate>Sat, 17 Jul 2010 18:01:19 +0000</pubDate>
		<guid isPermaLink="false">http://joshblog.net/?p=611#comment-74711</guid>
		<description>James, flash.sampler doesn&#039;t really count because it only works in the debug player. For the record, I was able to pass a private namespace object outside a class, but it only worked inside the class. I think I got a runtime error when I tried using it outside.</description>
		<content:encoded><![CDATA[<p>James, flash.sampler doesn&#8217;t really count because it only works in the debug player. For the record, I was able to pass a private namespace object outside a class, but it only worked inside the class. I think I got a runtime error when I tried using it outside.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Bond</title>
		<link>http://joshblog.net/2009/05/13/packages-are-actually-namespaces-in-actionscript-3/comment-page-1/#comment-74709</link>
		<dc:creator>James Bond</dc:creator>
		<pubDate>Sat, 17 Jul 2010 17:46:17 +0000</pubDate>
		<guid isPermaLink="false">http://joshblog.net/?p=611#comment-74709</guid>
		<description>Josh&#039;s last post is not strictly true (that you cannot access private member variables outside of the defining class).  If you are able to obtain the right Namespace object, you can create a QName, and subscript the object via that to access any arbitrary property.  The key issue is obtaining the actual Namespace object for a given class, which may not be possible in direct literal code.  However....

One trick you can use is to use the getMemberNames() top level function in the flash.sampler package to retrieve an object that can be used to iterate over all of the member variable names (private or not) in a given object [you must be in the debug player for this to work, and there are other conditions as well].  Iterating over the returned object with a &quot;for each&quot; loop yields a series of QName objects that can be used via the subscript notation to access the value of the corresponding property, and this includes private member variables.</description>
		<content:encoded><![CDATA[<p>Josh&#8217;s last post is not strictly true (that you cannot access private member variables outside of the defining class).  If you are able to obtain the right Namespace object, you can create a QName, and subscript the object via that to access any arbitrary property.  The key issue is obtaining the actual Namespace object for a given class, which may not be possible in direct literal code.  However&#8230;.</p>
<p>One trick you can use is to use the getMemberNames() top level function in the flash.sampler package to retrieve an object that can be used to iterate over all of the member variable names (private or not) in a given object [you must be in the debug player for this to work, and there are other conditions as well].  Iterating over the returned object with a &#8220;for each&#8221; loop yields a series of QName objects that can be used via the subscript notation to access the value of the corresponding property, and this includes private member variables.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh Tynjala</title>
		<link>http://joshblog.net/2009/05/13/packages-are-actually-namespaces-in-actionscript-3/comment-page-1/#comment-61961</link>
		<dc:creator>Josh Tynjala</dc:creator>
		<pubDate>Thu, 10 Dec 2009 09:43:25 +0000</pubDate>
		<guid isPermaLink="false">http://joshblog.net/?p=611#comment-61961</guid>
		<description>Yes, you&#039;re right, karfau. public/protected/private/internal are all namespaces. I think your code should look like this:

&lt;pre&gt;object.private::_privateObjectProperty&lt;/pre&gt;

Parentheses are used for E4X filtering, so they&#039;re in no way usable here.

However, that won&#039;t work. I&#039;ve spent a lot of time trying to hack namespaces to see just what I can get away with. It&#039;s not possible to access a private member outside it&#039;s class. The &lt;code&gt;private&lt;/code&gt; namespace is specifically defined with a different value in each class (on the global object, which is also a different object for each class file). So class Apple&#039;s private is not the same as class Orange&#039;s private.

In fact, it appears that the virtual machine has some extra protection. With the right function calls, you can trace the string representation of a particular class&#039; private namespace. However, if you try to define it in another class, it still won&#039;t let you access something that&#039;s private. Likewise, if you assign the private namespace to a variable and return it in a function call from the owning class to another class, it&#039;s still useless for accessing the private members. This may be AS3 traits in action, or the separation of global objects in classes, or maybe defined by the language itself. Regardless, I&#039;ve spent hours trying to hack &lt;code&gt;private&lt;/code&gt; just because it sounded like a fun blog post. That sort of exploration actually led to the package/namespace relationship I revealed here.</description>
		<content:encoded><![CDATA[<p>Yes, you&#8217;re right, karfau. public/protected/private/internal are all namespaces. I think your code should look like this:</p>
<pre>object.private::_privateObjectProperty</pre>
<p>Parentheses are used for E4X filtering, so they&#8217;re in no way usable here.</p>
<p>However, that won&#8217;t work. I&#8217;ve spent a lot of time trying to hack namespaces to see just what I can get away with. It&#8217;s not possible to access a private member outside it&#8217;s class. The <code>private</code> namespace is specifically defined with a different value in each class (on the global object, which is also a different object for each class file). So class Apple&#8217;s private is not the same as class Orange&#8217;s private.</p>
<p>In fact, it appears that the virtual machine has some extra protection. With the right function calls, you can trace the string representation of a particular class&#8217; private namespace. However, if you try to define it in another class, it still won&#8217;t let you access something that&#8217;s private. Likewise, if you assign the private namespace to a variable and return it in a function call from the owning class to another class, it&#8217;s still useless for accessing the private members. This may be AS3 traits in action, or the separation of global objects in classes, or maybe defined by the language itself. Regardless, I&#8217;ve spent hours trying to hack <code>private</code> just because it sounded like a fun blog post. That sort of exploration actually led to the package/namespace relationship I revealed here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: karfau</title>
		<link>http://joshblog.net/2009/05/13/packages-are-actually-namespaces-in-actionscript-3/comment-page-1/#comment-61960</link>
		<dc:creator>karfau</dc:creator>
		<pubDate>Thu, 10 Dec 2009 09:19:12 +0000</pubDate>
		<guid isPermaLink="false">http://joshblog.net/?p=611#comment-61960</guid>
		<description>this goes even further:
even public, protected and private are just namespaces:
usage from outside of the class would look like this:
&lt;code&gt;
var myref:* = object.(private::_privateObjectProperty);
&lt;/code&gt;
wich compiles fine but (fortunately) throws a Type-Error when running:
TypeError: Error #1123: Filter-Operator not supported for type [type of object].

hopefully there is no way to get around this limitation (espacially for private and protected). I saw code-examples that changed properties of Flex-Components this way where those properties lay in the mx_internal-namespace.

karfau</description>
		<content:encoded><![CDATA[<p>this goes even further:<br />
even public, protected and private are just namespaces:<br />
usage from outside of the class would look like this:<br />
<code><br />
var myref:* = object.(private::_privateObjectProperty);<br />
</code><br />
wich compiles fine but (fortunately) throws a Type-Error when running:<br />
TypeError: Error #1123: Filter-Operator not supported for type [type of object].</p>
<p>hopefully there is no way to get around this limitation (espacially for private and protected). I saw code-examples that changed properties of Flex-Components this way where those properties lay in the mx_internal-namespace.</p>
<p>karfau</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samuel Asher Rivello</title>
		<link>http://joshblog.net/2009/05/13/packages-are-actually-namespaces-in-actionscript-3/comment-page-1/#comment-61008</link>
		<dc:creator>Samuel Asher Rivello</dc:creator>
		<pubDate>Mon, 01 Jun 2009 08:47:00 +0000</pubDate>
		<guid isPermaLink="false">http://joshblog.net/?p=611#comment-61008</guid>
		<description>Great post. I love the idea of assisting developers so they only seeing the methods via intellisense (of Flex Builder) for methods they need to see. I created a new demo to show that off. http://www.blog.rivello.org/?p=422</description>
		<content:encoded><![CDATA[<p>Great post. I love the idea of assisting developers so they only seeing the methods via intellisense (of Flex Builder) for methods they need to see. I created a new demo to show that off. <a href="http://www.blog.rivello.org/?p=422" rel="nofollow">http://www.blog.rivello.org/?p=422</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Almog Kurtser</title>
		<link>http://joshblog.net/2009/05/13/packages-are-actually-namespaces-in-actionscript-3/comment-page-1/#comment-60968</link>
		<dc:creator>Almog Kurtser</dc:creator>
		<pubDate>Sat, 16 May 2009 14:16:54 +0000</pubDate>
		<guid isPermaLink="false">http://joshblog.net/?p=611#comment-60968</guid>
		<description>Great discovery, used this in &lt;a href=&quot;http://stackoverflow.com/questions/843981/how-do-i-reference-a-global-class-from-a-class-with-the-same-name-in-actionscript/872503#872503&quot; rel=&quot;nofollow&quot;&gt;my answer to a stackoverflow question&lt;/a&gt;.
</description>
		<content:encoded><![CDATA[<p>Great discovery, used this in <a href="http://stackoverflow.com/questions/843981/how-do-i-reference-a-global-class-from-a-class-with-the-same-name-in-actionscript/872503#872503" rel="nofollow">my answer to a stackoverflow question</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ian</title>
		<link>http://joshblog.net/2009/05/13/packages-are-actually-namespaces-in-actionscript-3/comment-page-1/#comment-60965</link>
		<dc:creator>Ian</dc:creator>
		<pubDate>Thu, 14 May 2009 17:26:34 +0000</pubDate>
		<guid isPermaLink="false">http://joshblog.net/?p=611#comment-60965</guid>
		<description>How funny! I just made the same discovery about the change from &quot;.&quot; to &quot;::&quot; yesterday.

Unlike you, I was just distressed. It took me an hour to sort out why my app wasn&#039;t working.</description>
		<content:encoded><![CDATA[<p>How funny! I just made the same discovery about the change from &#8220;.&#8221; to &#8220;::&#8221; yesterday.</p>
<p>Unlike you, I was just distressed. It took me an hour to sort out why my app wasn&#8217;t working.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
