From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Georg Bauhaus Newsgroups: comp.lang.ada Subject: Re: Top 10 Worst C# Features Date: Fri, 4 Sep 2015 09:33:07 +0200 Organization: A noiseless patient Spider Message-ID: References: Reply-To: nonlegitur@futureapps.de Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 4 Sep 2015 07:31:20 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="f7972c5513f369b1efd12133304f7abd"; logging-data="7002"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Bx5DD+aWEoK3pjcSauk4X2shbVmGDDy0=" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 In-Reply-To: Cancel-Lock: sha1:w+W4UdznVhqeX5SQTQ43uS5Kdb4= Xref: news.eternal-september.org comp.lang.ada:27702 Date: 2015-09-04T09:33:07+02:00 List-Id: On 03.09.15 21:12, Randy Brukardt wrote: > "G.B." wrote in message > news:ms9cm8$leh$1@dont-email.me... > ... >> AFAICT, today we have string literals identifying things >> that can be called (Gtk), or we have selectors (Objective-C) >> for a similar thing, etc. A mouse click or gesture is thus >> another kind of event to which programmers might want to attach >> something that reacts. How would static type systems help, >> knowing that trying to make them help has allegedly failed >> in the past? > > I have no idea why you think this is a problem. Much like Objective-C is making use of C for implementing a rather flexible O-O PL, one could use Ada the same way, or one can use Ada's existing O-O features for implementing GUI style event handling programs. But this addresses the problem (GUI event driven programming, say) at the level of implementation, i.e. not directly. The language is not generally providing wishes to objects, for handling events of various sorts. Simply because Ada, like most languages I guess, doesn't address events in the language, except for a very few. These "events" can be mapped to problem domain events. Like objects dying, or signals handled in a PO, or file streams ending in an I/O exception. GUI programming is therefore just using general programming features for implementing callback style subprograms that involve objects. Programmers know the recommended ways, work is based on conventions. The model is implying the existence of some conventional run loop that operates using conventional means of the language. Events are implicit, not language. So, while there is no problem with either a very flexible O-O system emulated in C, or with having the Ada compiler help with earlier binding, both approaches do not handle events in the language. That's not a problem, but it is an opportunity, I think. > So I fail to see any problem that isn't being addressed here. Finalization > is a very special kettle of fish, because the objects don't exist > afterwards. It's needed to provide last wishes to objects, for clean-up of > various sorts. (For instance, Claw uses finalization to unhook windows from > the active window list, else we'd be calling actions on non-existent > windows. There is no other bullet-proof way to do that, if one wants there > library to work in the face of exceptions and abort, as well as programmer > mistakes [failing to call Close appropriately].)