From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Top 10 Worst C# Features
Date: Sat, 5 Sep 2015 09:21:31 +0200
Date: 2015-09-05T09:21:31+02:00 [thread overview]
Message-ID: <1ua50qw5jsnov.y1h28aoi7447$.dlg@40tude.net> (raw)
In-Reply-To: d4vhcnF9eulU1@mid.individual.net
On Sat, 5 Sep 2015 09:45:43 +0300, Niklas Holsti wrote:
> - Outputs of a computation can be made available to a caller, without
> the caller having to declare "out" variables, by implementing the
> computation in the elaboration block in the body of a generic package,
> which has generic formal objects corresponding to the formal "in" and
> "in out" parameters of the computation, and declares public variables
> corresponding to the "out" parameters of the computation. To "call" this
> computation, the "caller" instantiates the generic, and can then access
> the public variables of the instance, with the values computed at
> elaboration of the instance, without explicitly declaring her own
> variables for use as "outs". But I'm sure that most programmers would
> consider this to be a weird misuse of the generic facility. Further, the
> instantiation must be done as a declaration, not as a statement, and the
> "out" variables can seldom be declared constant, because the computation
> is often too complex to be done in the declaration of the generic package.
It is worth to have a language construct for this. There are cases beyond
multiple out parameters when this is necessary, e.g.
if X in T'Class then
declare
Y : T'Class renames T'Class (X);
or
if Ptr /= null then
declare
X : T := Ptr.all;
> In a more functional-programming approach, a procedure could be made to
> "return" its outputs by calling different "continuation" procedures
> (given as "in" parameters) for the different outcomes; each such
> continuation procedure could have its own set of "in" parameters
> corresponding to the "outs" available from the original procedure in
> this outcome. This would be rather far from the procedural Ada style,
> but perhaps it could be used as the internal implementation of what I
> proposed above, even if the source syntax does not look like continuations.
This is an independent case to me. It falls into the basket "co-routines".
If we had co-routines we could use them to handle multiple outputs.
BTW, this is rather data-driven approach than functional. DDA is a mess on
a much bigger scale than one could imagine...
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2015-09-05 7:21 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
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 [this message]
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