| Deutsch English Français Italiano |
|
<20240625180928.43fcc5c1@lud1.home> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Luc <luc@sep.invalid>
Newsgroups: comp.lang.tcl
Subject: My hang-up about OOP (snit)
Date: Tue, 25 Jun 2024 18:09:28 -0300
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <20240625180928.43fcc5c1@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 25 Jun 2024 23:09:29 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="91916e09b13d8e03225c6dec34468415";
logging-data="1828133"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+sa1gi/AuQqQxCn+wE4JkVB0lp5wKNUwk="
Cancel-Lock: sha1:8O4rAUBQcsaGvlXKFEddUBUJh4k=
Bytes: 1369
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
>>