In article <0AB1E374-4F2A-11D8-84B3-000A958E6254 / loudthinking.com>, David Heinemeier Hansson wrote:
>> You could just use a class variable (e.g. @@x) instead, the downside 
>> being that it *would* be variable rather than constant.
> 
> Right. The problem is that this really is a constant. The previous 
> example was a bit abstract. This should be more telling of my 
> intentions:
> 
> class Subscription # abstract
>      def price_with_discount
> 	    PRICE * 0.9
>      end
> end
> 
> class BasicSubscription < Subscription
>      PRICE = 19
> end
> 
> class PlusSubscription < Subscription
>      PRICE = 49
> end

Doesn't answer the original question, but I'd disagree that PRICE should
be a constant anyway.  It's not a fundamental property of the
subscription, it's a number you set on it based on economic conditions.
You'll want to be able to raise and lower it as economics change.

(If that makes you feel any better about taking the easy way out.)

> ..but perhaps you're right. A class variable would probably suffice.

Joe