In article <20040409081148.GA14638 / sunserv.kfki.hu>, Bedo Sandor <bsanyi / sunserv.kfki.hu> wrote: >On Fri, Apr 09, 2004 at 02:24:16PM +0900, Phil Tomson wrote: >> def :=(value) #not currently possible, but it would be cool >> check_value(value) >> @value = value >> end >> >> [...] >> >> This would allow you to do: >> >> b = Ternary.new >> b := 2 >> b := 42 #raise exception > >I think << operator is very expressive in that case, and >world peace conformant. Am I wrong? > > > def <<(value) > check_value(value = value.to_i) > @value = value > end >.. > >b = Ternary.new >b << 2 >b << 42 > Yeah, that would work, though I'm used to thinking of '<<' as push for arrays. Phil