From: GOTO Kentaro Date: 2001-08-12T15:00:27+09:00 Subject: [ruby-talk:19576] Re: Why not access control for instance and class variables? From: ptkwt@shell1.aracnet.com (Phil Tomson) Subject: [ruby-talk:19574] Why not access control for instance and class variables? Date: Sun, 12 Aug 2001 14:04:08 +0900 > Maybe this is a silly question, but with all the recent talk about how > subclasses can modify class variables > and how that is possibly dangerous... why can't the access control > functions (public,protected,private) be applied to class variables and > instance variables as well? So that if you had: Recently, some possibilities were discussed at Japanese list. The goal is to avoid unexpected name confliction. (0) All @variable should be private (my opinion, but this has been rejected because of backward comptibility). (1) Gentlemen's agreement; a kind of special name should be given to instance variables which is intended to be private. (2) Mangling feature something like Python's way may help the above. In this case we would adopt new prefix, e.g., @_, for private. By the way, can't private class variables be mimicked by constats? -- Gotoken