<?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"
	>
<channel>
	<title>Comments on: C++ Enemy Functions</title>
	<atom:link href="http://mark.santaniello.com/archives/200/feed" rel="self" type="application/rss+xml" />
	<link>http://mark.santaniello.com/archives/200</link>
	<description>the body of a very slow loop</description>
	<pubDate>Fri, 21 Nov 2008 12:12:30 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Mark</title>
		<link>http://mark.santaniello.com/archives/200#comment-3299</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Fri, 02 Jun 2006 22:49:42 +0000</pubDate>
		<guid isPermaLink="false">http://mark.santaniello.net/archives/200#comment-3299</guid>
		<description>Kevin,

I'm looking on page 356 of my Programming Ruby book (the access control section), and all I see are public, protected, and private.  What am I missing?

Maybe you're just talking about open classes (or open objects).  I'm no expert, but I'd guess these features can trace their lineage back much further than Ruby.  Smalltalk?  Some other dynamically-typed object-oriented language?
</description>
		<content:encoded><![CDATA[<p>Kevin,</p>
<p>I&#8217;m looking on page 356 of my Programming Ruby book (the access control section), and all I see are public, protected, and private.  What am I missing?</p>
<p>Maybe you&#8217;re just talking about open classes (or open objects).  I&#8217;m no expert, but I&#8217;d guess these features can trace their lineage back much further than Ruby.  Smalltalk?  Some other dynamically-typed object-oriented language?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://mark.santaniello.com/archives/200#comment-3298</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Fri, 02 Jun 2006 22:42:14 +0000</pubDate>
		<guid isPermaLink="false">http://mark.santaniello.net/archives/200#comment-3298</guid>
		<description>Bheesh,

I actually had a similar idea too (I had envisioned a completely implicit this pointer), but I didn't blog about it.  

It rocks that the namespace can be "open" whereas the class is "closed".  This is one benefit of Scott Meyer's "FooStuff" approach that I could not replicate with my enemy access qualifier.

Additionally, this would be very easy to add to the language.  In my original proposal, we'd have problem with any existing source codes that already used the word "enemy".  But, since your syntax is currently illegal in C++, it should be OK to support it retroactively.

There may also be some benefits in terms of compatibility with the current rules for C++ Koenig lookup.

In short, I think it's a great idea.</description>
		<content:encoded><![CDATA[<p>Bheesh,</p>
<p>I actually had a similar idea too (I had envisioned a completely implicit this pointer), but I didn&#8217;t blog about it.  </p>
<p>It rocks that the namespace can be &#8220;open&#8221; whereas the class is &#8220;closed&#8221;.  This is one benefit of Scott Meyer&#8217;s &#8220;FooStuff&#8221; approach that I could not replicate with my enemy access qualifier.</p>
<p>Additionally, this would be very easy to add to the language.  In my original proposal, we&#8217;d have problem with any existing source codes that already used the word &#8220;enemy&#8221;.  But, since your syntax is currently illegal in C++, it should be OK to support it retroactively.</p>
<p>There may also be some benefits in terms of compatibility with the current rules for C++ Koenig lookup.</p>
<p>In short, I think it&#8217;s a great idea.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Hickey</title>
		<link>http://mark.santaniello.com/archives/200#comment-3287</link>
		<dc:creator>Kevin Hickey</dc:creator>
		<pubDate>Thu, 01 Jun 2006 18:30:30 +0000</pubDate>
		<guid isPermaLink="false">http://mark.santaniello.net/archives/200#comment-3287</guid>
		<description>That's been done.  It's called Ruby.</description>
		<content:encoded><![CDATA[<p>That&#8217;s been done.  It&#8217;s called Ruby.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bheeshmar</title>
		<link>http://mark.santaniello.com/archives/200#comment-3283</link>
		<dc:creator>Bheeshmar</dc:creator>
		<pubDate>Thu, 01 Jun 2006 15:17:00 +0000</pubDate>
		<guid isPermaLink="false">http://mark.santaniello.net/archives/200#comment-3283</guid>
		<description>Interesting idea, but I propose a refinement.

I think the language should be extended so that if you create a namespace with the same name as the class, and functions in it take an explicit "this" as a first parameter, then they can be called as members.

Por ejemplo:

&lt;code&gt;
class Foo
{
  public:
    void bar( int n ) { n_ = n; }
    int bar() const { return n_; }
};

namespace Foo
{
  int baz( Foo &#38; foo, int n ) { foo.bar( n + 5 ); return foo.bar(); }
}

Foo foo;
foo.bar( 6 );
assert( 6 == foo.bar() );
assert( 10 == foo.baz( 4 ) );
assert( 10 == foo.bar() );
&lt;/code&gt;

My rationale for this is that namespaces are extensible and classes are not.  It's likely that you'll think of more functions AFTER designing the class than before, so allow convenience functions (defined in terms of public methods) to be called as though they are members.

What do you think?</description>
		<content:encoded><![CDATA[<p>Interesting idea, but I propose a refinement.</p>
<p>I think the language should be extended so that if you create a namespace with the same name as the class, and functions in it take an explicit &#8220;this&#8221; as a first parameter, then they can be called as members.</p>
<p>Por ejemplo:</p>
<p><code><br />
class Foo<br />
{<br />
  public:<br />
    void bar( int n ) { n_ = n; }<br />
    int bar() const { return n_; }<br />
};</p>
<p>namespace Foo<br />
{<br />
  int baz( Foo &amp; foo, int n ) { foo.bar( n + 5 ); return foo.bar(); }<br />
}</p>
<p>Foo foo;<br />
foo.bar( 6 );<br />
assert( 6 == foo.bar() );<br />
assert( 10 == foo.baz( 4 ) );<br />
assert( 10 == foo.bar() );<br />
</code></p>
<p>My rationale for this is that namespaces are extensible and classes are not.  It&#8217;s likely that you&#8217;ll think of more functions AFTER designing the class than before, so allow convenience functions (defined in terms of public methods) to be called as though they are members.</p>
<p>What do you think?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
