| Deutsch English Français Italiano |
|
<vbtr9t$327q$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!npeer.as286.net!dummy01.as286.net!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: "Randy Brukardt" <randy@rrsoftware.com>
Newsgroups: comp.lang.ada
Subject: Re: Ichbiah 2022 compiler mode
Date: Wed, 11 Sep 2024 23:39:27 -0500
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <vbtr9t$327q$1@dont-email.me>
References: <vbc625$at65$1@dont-email.me> <vbdgs7$hedr$1@dont-email.me> <vbdk2t$hj0r$6@dont-email.me>
Injection-Date: Thu, 12 Sep 2024 06:39:25 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="63a211bc0083a84961071e8a6410a533";
logging-data="100602"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19AyUhr0GGxi50bQJadZOr+0MhRb+96ZcM="
Cancel-Lock: sha1:F8C6vGPx0MDlwt+cRHP0ODUI/YU=
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-RFC2646: Format=Flowed; Original
X-MSMail-Priority: Normal
Bytes: 2421
"Lawrence D'Oliveiro" <ldo@nz.invalid> wrote in message
news:vbdk2t$hj0r$6@dont-email.me...
> On Thu, 5 Sep 2024 19:03:22 -0500, Randy Brukardt wrote:
....
>> (10) Variable-returning functions are introduced.
>
> Is this like updater functions in POP-11, or "setf" in Lisp? So you have a
> procedure
>
> set_var(«var», «new value»)
>
> which is declared to be attached to «var» in some way, such that when you
> write
>
> «var» := «new_value»
>
> this automatically invokes set_var?
No, it is a function that returns a variable, meaning you can assign into
the function result. If you have:
function Foo return variable Integer;
then you can use Foo on either side of an assignment:
Foo := 1;
Bar := Foo + 1;
Essentially, this idea treats:
Var : variable Integer;
as syntactic sugar for
function Var return variable Integer;
The worth of that is two-fold: (1) Objects and functions now resolve the
same; (2) one can write a function that acts exactly like an object, and
thus can replace it in all uses.
Note that Ada currently has generalized reference objects and functions that
return anonymous access types, and both of these act similarly to a variable
returning function. But neither is quite a perfect match.
Randy.