comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus@futureapps.invalid>
Subject: Re: Top 10 Worst C# Features
Date: Thu, 3 Sep 2015 10:14:35 +0200
Date: 2015-09-03T10:14:35+02:00	[thread overview]
Message-ID: <ms8ve0$57u$1@dont-email.me> (raw)
In-Reply-To: <ms7j9r$ho$1@loke.gir.dk>

On 02.09.15 21:39, Randy Brukardt wrote:
> "[they] run
> deterministically, run on the current thread, and never run on partially
> constructed objects."
> Moreover, they always run when objects are destroyed, while apparently in C#
> they don't run for explicit calls to Dispose.

Still, finalizers are an accidental bit of design. It uses just scopes
and it involves garbage. And while that's something, this very bit is
being carried to the limit, perhaps too far: if finalizers are popular,
problems pop up with corresponding frequency.

What finalization can presumably solve I'd love to see addressed
systematically, using language that attaches life cycle events to
types. Events addressable in the type's very definition, not attached
by implication, testament style, about things to happen while objects
are dying. Events becoming part of the type definition, the program
then makes the objects react to events while they are still alive and
well. Actions will no longer be some "last words" that require
additional efforts to get right.

Is it possible to produce a scheme that makes attaching "event
subprograms", say, well defined? Maybe permissions would be based
on visibility of entities referred to?

For a start, using subprograms,

    type T is ...
    for T'Some_Event use ...

or

    type T is ...
    with T'Some_Event => ...

When new attachments would be desired in deeper scope, maybe one could
use some type derived there.

  reply	other threads:[~2015-09-03  8:14 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-02 10:59 Top 10 Worst C# Features Stefan.Lucks
2015-09-02 17:37 ` Álex R. Mosteo
2015-09-02 19:39 ` Randy Brukardt
2015-09-03  8:14   ` Georg Bauhaus [this message]
2015-09-03  9:26     ` Dmitry A. Kazakov
2015-09-03 11:39       ` G.B.
2015-09-03 12:00         ` G.B.
2015-09-03 13:59           ` Dmitry A. Kazakov
2015-09-03 19:12           ` Randy Brukardt
2015-09-04  7:33             ` Georg Bauhaus
2015-09-04 21:34               ` Randy Brukardt
2015-09-05  6:31                 ` Dmitry A. Kazakov
2015-09-05  6:44                 ` Georg Bauhaus
2015-09-05  7:07                   ` Dmitry A. Kazakov
2015-09-05  6:45                 ` Niklas Holsti
2015-09-05  7:21                   ` Dmitry A. Kazakov
2015-09-05 12:07                   ` Peter Chapin
2015-09-06 10:45                   ` Georg Bauhaus
2015-10-13 19:57                   ` Eryndlia Mavourneen
2015-09-05  7:16                 ` Shark8
2015-09-03 13:47         ` Dmitry A. Kazakov
2015-09-03  8:51 ` gautier_niouzes
2015-10-01 14:03 ` Paul Colin de Gloucester
2015-10-14  8:00   ` Maciej Sobczak
2015-10-14 14:26     ` Ben Bacarisse
2015-10-14 16:50       ` Paul Rubin
2015-10-14 18:17         ` Stefan.Lucks
2015-10-14 19:54           ` Ben Bacarisse
2015-10-15 12:24       ` Maciej Sobczak
2015-10-15 13:59         ` Ben Bacarisse
2015-11-06 14:50     ` Nicholas Collin Paul de Gloucester
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox