From: 7stud -- Date: 2012-12-01T04:09:49+09:00 Subject: Re: Novice: Understanding Constants - Definition and Redefinition Steve Tu wrote in post #1087312: > > What I'm then confused about is really two things: > 1) Why is it allowable to in effect modify a class? > Because ruby allows you to change things at will. There are still other ways to change a class other than the ways you have learned so far, for instance a user can enter a name and you can add a method with that name to a class. > 2) I thought everything was in a method anyway - but why is it not > allowed to do something like Const::NEW_CONST = value > Well based on that logic, then because assignment to variables is typically done with method names that end in '=', you should wonder whether there is a method named "Const::NEW_CONST=". > but then allow Const.const_set("CONSTANT", value)? That's just the way it is. -- Posted via http://www.ruby-forum.com/.