R
Randy W. Sims
gabriele said:Randy W. Sims ha scritto:
Sounds sort of like a traits[1] or what Perl 6 refers to as
roles[2][3]. But, then this is deeper Ruby than I'm familiar with.
I think traits mostly are what we call modules
I'm still learning Ruby, but aren't modules pretty much static? I think
of traits as a set of behaviors that an object can take on at any point
in it's lifetime. These behaviors are specific to that instance. They
are transient behaviors that can be taken on and latter shed off. You
would test for the presence of a trait before using it (much like
testing is_a?). etc.
Randy.