comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Haskell, anyone?
Date: Thu, 19 Nov 2015 15:27:35 -0600
Date: 2015-11-19T15:27:35-06:00	[thread overview]
Message-ID: <n2les8$eem$1@loke.gir.dk> (raw)
In-Reply-To: 36a48f94-41ee-491a-8312-d6e7732bf482@googlegroups.com

"Hadrien Grasland" <hadrien.grasland@gmail.com> wrote in message 
news:36a48f94-41ee-491a-8312-d6e7732bf482@googlegroups.com...
...
>Actually, speaking of functional programming Ada, I'm curious : would there
>be an elegant way to produce a higher-order function equivalent in Ada ?
>
>Ada sure has the very powerful ability to declare functions within 
>functions,
>and it also has function pointers. But due to the way accessibility rules 
>work,
>my understanding is that this would not be enough to implement things like
>partial application or containers of functions, because once we leave the
>scope of a function, it instantly ceases to exist.
>
...
>Or have I missed some important language feature which could be used to
>this end, like a way to serialize a function and its state to a stream ?

Not really. Some of what you're thinking of would work using anonymous 
access to subprogram parameters (which do not require any accessibility 
check). That allows passing any function to another one. But as those are 
limited to parameters, it's hard to keep them around for long.

That means they're good for iteration and mapping constructs. Not so much 
for lazy evaluation or partial application.

On a couple of occassions, we've talked about named anonymous 
access-to-subprogram types (obviously a bad name that would get replaced if 
something on this line was adopted). Those would have a representation that 
would have enough information to call a nested subprogram; 'Unchecked_Access 
would be used to create values (so you'd be on your own to prevent calls to 
dangling subprograms). That would allow longer term storage of such 
subprograms (useful for subprograms declared in generic instances or 
long-lived subprograms like the main subprogram). These haven't gone 
anywhere. (The usual context is GNAT's 'Unrestricted_Access, a mechanism 
that cannot be reasonably adopted in other compilers; the GCC memory model 
makes it possible. Many of us would like something in the language so that 
'Unrestricted_Access wouldn't be anywhere near as necessary.)

But I don't know of anything on the drawing boards for partial application 
or similar things. So far as I know, no one has asked (formally or 
informally).

                                          Randy.


  parent reply	other threads:[~2015-11-19 21:27 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-15 20:42 Haskell, anyone? mockturtle
2015-11-15 20:51 ` Paul Rubin
2015-11-15 20:53 ` Nasser M. Abbasi
2015-11-15 21:50 ` Mark Carroll
2015-11-15 22:11 ` mockturtle
2015-11-15 22:48   ` Nasser M. Abbasi
2015-11-15 23:05     ` Mark Carroll
2015-11-16  4:11       ` Paul Rubin
2015-11-16  5:17         ` Nasser M. Abbasi
2015-11-16  5:48           ` Paul Rubin
2015-11-16  5:59             ` Nasser M. Abbasi
2015-11-16  6:47               ` Paul Rubin
2015-11-16  8:45           ` Simon Wright
2015-11-16 14:38             ` Brian Drummond
2015-11-15 23:19     ` Jeffrey R. Carter
2015-11-16  9:36       ` J-P. Rosen
2015-11-16 18:14         ` Jeffrey R. Carter
2015-11-16  3:59   ` Paul Rubin
2015-11-16  8:33   ` Dmitry A. Kazakov
2015-11-16  9:33     ` mockturtle
2015-11-16  9:45       ` Paul Rubin
2015-11-16 10:25 ` Hadrien Grasland
2015-11-16 11:19   ` Simon Wright
2015-11-16 11:25     ` Hadrien Grasland
2015-11-16 13:59   ` G.B.
2015-11-16 20:24   ` Jeffrey R. Carter
2015-11-16 23:23   ` Paul Rubin
2015-11-17  8:26     ` Dmitry A. Kazakov
2015-11-17  9:10       ` Mark Carroll
2015-11-17 20:09         ` Dmitry A. Kazakov
2015-11-17 10:49     ` Hadrien Grasland
2015-11-17 12:01       ` G.B.
2015-11-17 16:43         ` Hadrien Grasland
2015-11-17 18:04           ` Paul Rubin
2015-11-17 21:42             ` Hadrien Grasland
2015-11-18  4:36               ` Paul Rubin
2015-11-18  8:48                 ` Hadrien Grasland
2015-11-18  9:23                   ` Paul Rubin
2015-11-18 10:44                     ` Hadrien Grasland
2015-11-18 11:02                       ` Dmitry A. Kazakov
2015-11-18 12:41                         ` G.B.
2015-11-18 23:06                       ` Randy Brukardt
2015-11-19  8:56                         ` Hadrien Grasland
2015-11-19  9:19                           ` Hadrien Grasland
2015-11-19 21:27                           ` Randy Brukardt [this message]
2015-11-24 12:03                           ` Jacob Sparre Andersen
2015-11-19  7:22                       ` Paul Rubin
2015-11-19  9:39                         ` Hadrien Grasland
2015-11-17 13:01       ` Thomas Løcke
2015-11-17 16:45         ` Hadrien Grasland
2015-11-18  0:11       ` Paul Rubin
2015-11-18  9:44         ` Hadrien Grasland
2015-12-06 12:59   ` David Thompson
2015-12-07  7:25     ` Hadrien Grasland
replies disabled

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