{"id":313,"date":"2009-04-15T11:12:25","date_gmt":"2009-04-15T10:12:25","guid":{"rendered":"http:\/\/fiber-space.de\/wordpress\/?p=313"},"modified":"2009-04-15T11:14:00","modified_gmt":"2009-04-15T10:14:00","slug":"the-statement-that-never-was","status":"publish","type":"post","link":"http:\/\/fiber-space.de\/wordpress\/2009\/04\/15\/the-statement-that-never-was\/","title":{"rendered":"The statement that never was"},"content":{"rendered":"<p>The Python <a href=\"http:\/\/www.python.org\/download\/releases\/src\/\">release archive<\/a> is a nice repository for archaeological findings. My biggest surprise was the existence of an access statement and `access` keyword in the pre-history of Python 1.5.0. The syntax was already specified in release 1.0 with an accompanying `accessobject.c`  and it began to fade in Python 1.4.<\/p>\n<h3>The access statement<\/h3>\n<p\/>\nThat is how the access statement was defined in 1.0<\/p>\n<pre lang=\"python\">access_stmt: 'access' ('*' | NAME (',' NAME)*) ':' accesstype  (',' accesstype)*\r\naccesstype: NAME+\r\n# accesstype should be ('public' | 'protected' | 'private') ['read'] ['write']\r\n# but can't be because that would create undesirable reserved words!<\/pre>\n<p>The `access_stmt` was a small statement i.e. one that doesn&#8217;t contain a block and could be used like `print`, `del` or `exec`.<\/p>\n<p>So the proper use of the access statement would be like<\/p>\n<pre lang=\"python\">class Point:\r\n    access x, y, z: private write, public read<\/pre>\n<p>or more compact:<\/p>\n<pre lang=\"python\">class Point:\r\n    access *: private write, public read<\/pre>\n<p>The word `public` wasn&#8217;t a language keyword which made it possible to use it in this way:<\/p>\n<pre lang=\"python\">class AccessModifier:\r\n    access public: public\r\n    access private: public\r\n    access protected: public<\/pre>\n<p>Note that the access statement was purely declarative even more so than Java&#8217;s where you can write<\/p>\n<pre><span style=\"font-size: small;\">public int x = 10;<\/span><\/pre>\n<p>and define `x` while specifying its type and access modifier. It was also more elaborated in terms of intended protections by means of differentiating between `read` and `write`.<\/p>\n<h3>How it never took off and gone away<\/h3>\n<p\/>\nIn the `HISTORY` file of Python 1.0 we find the notice<\/p>\n<blockquote><p>There&#8217;s a new reserved word: &#8220;access&#8221;.  The syntax and semantics are<br \/>\nstill subject of of research and debate (as well as undocumented), but<br \/>\nthe parser knows about the keyword so you must not use it as a<br \/>\nvariable, function, or attribute name.<\/p><\/blockquote>\n<p>In Python 1.4 the access statement was already uncommented from the `Grammar`.<\/p>\n<p>The story ends with the following remark in the `HISTORY` of Python 1.5:<\/p>\n<blockquote><p>&#8216;access&#8217; is no longer a reserved word, and all code related to its<br \/>\nimplementation is gone (or at least #ifdef&#8217;ed out).  This should make<br \/>\nPython a little speedier too!<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>The Python release archive is a nice repository for archaeological findings. My biggest surprise was the existence of an access statement and `access` keyword in the pre-history of Python 1.5.0. The syntax was already specified in release 1.0 with an &hellip; <a href=\"http:\/\/fiber-space.de\/wordpress\/2009\/04\/15\/the-statement-that-never-was\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1,4],"tags":[17],"_links":{"self":[{"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/posts\/313"}],"collection":[{"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/comments?post=313"}],"version-history":[{"count":7,"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/posts\/313\/revisions"}],"predecessor-version":[{"id":320,"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/posts\/313\/revisions\/320"}],"wp:attachment":[{"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/media?parent=313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/categories?post=313"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/fiber-space.de\/wordpress\/wp-json\/wp\/v2\/tags?post=313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}