Sujet : My hang-up about OOP (snit)
De : luc (at) *nospam* sep.invalid (Luc)
Groupes : comp.lang.tclDate : 25. Jun 2024, 22:09:28
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240625180928.43fcc5c1@lud1.home>
It's hard for me to accept OOP because as hard as I try I really can't
not think that OOP is the Emperor's new clothes.
Example from snit:
snit::type dog {
method {tail wag} {} {return "Wag, wag"}
method {tail droop} {} {return "Droop, droop"}
}
dog spot
puts [spot tail wag]
puts [spot tail droop]
Why exactly is that any better than this:
proc dog {args} {
if {$args == "tail wag"} {return "Wag, wag"}
if {$args == "tail droop"} {return "Droop, droop"}
}
puts [dog tail wag]
puts [dog tail droop]
-- Luc>