Groups | Search | Server Info | Login | Register
Groups > comp.lang.misc > #11429
| From | bart <bc@freeuk.com> |
|---|---|
| Newsgroups | comp.lang.misc |
| Subject | Re: Algol 68 / Genie - new release |
| Date | 2025-10-13 23:13 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <10cjtik$2h643$1@dont-email.me> (permalink) |
| References | (14 earlier) <10btkhq$3ao5s$1@dont-email.me> <10c6h3e$18jia$1@paganini.bofh.team> <10cb9e9$5f2i$1@dont-email.me> <10cblbd$8n06$1@dont-email.me> <10cji48$2dudp$1@dont-email.me> |
On 13/10/2025 19:58, David Brown wrote: > On 10/10/2025 21:04, bart wrote: > There was a discussion elsewhere about gcc's handling of nested > functions sometimes needing an executable stack, or other complications. > This occurs when you have a nested function that has a closure - thus > needing a hidden struct pointer - but where it needs to be passed > somewhere as though it were a pointer to a function without this extra > parameter. One way to handle this is with a small function created > directly on the stack. Thanks for clearing that up. I think I would have simply disallowed such uses. Why should a special function with a hidden extra parameter be able to masquerade as an ordinary function? The same point comes up later on. Let the user make their own arrangements for this. (This is actually a similar problem to what happens when an interpreted language has to pass a function reference via an FFI to be used as a callback function. Obviously, native code functions can't directly call a function pointer that refers to some byte code rather than machine instructions. There needs to be something inbetween. I've never fully solved that for the general case. But I had in mind a fixed number of predefined, intermediate, native code functions that sit between the external library, and a special reentry point to the interpreter. I /think/ it can be done with data rather than new executable code.) > Let me try to describe a possible real-world use, using an imaginary > language to avoid any bias or complicating things with real-world syntax > details. > > You have a marvellous string sorting function, taking an array of > strings and a comparison function as a parameter : > > sort_strings(string s[], function comp(string, string)) > > You can use this with comparison functions that are case-sensitive, > reverse-order case-insensitive, or whatever you like. > define make_sort_func(string country) : > sort_func = lambda(string s1, string s2) : > return compare_names(s1, s2, country) > return sort_func > > Now you can do your sorting with : > > define sort_names(string s[], string country) : > sort_strings(s[], make_sort_func(country)) > > > > Somehow, you have got to create a function that compares two strings, > with that function depending on an independent input (the country). That > is a closure - you've made a new function that is based on the three- > parameter compare_names function and a bit of captured data. Whether you > want to do that with a lambda (an anonymous function), a named lambda, a > function that returns a new function, or a local function, is just a > matter of style and taste (assuming the language supports the feature). > > Of course there are always ways to avoid this - such as making your > original "sort_strings" function take a "void *" parameter that is > passed to the comparison function as an environment, or making an array > of sort functions indexed by country. But I hope that example shows > that closures and higher-order functions can be useful in simple > examples that are not purely theoretical, and that it is clear what the > code above is doing. You've used static typing for your examples: the sort function clearly takes two arguments, not optionally an extra argument! So, is this an example where a 'trampoline' is needed, to pretend your true sort function is a simple 2-operand one? I don't think this is going to be help performance any, not on Windows (I understand Linux does something special here). But as you say, this example isn't that compelling, as there are any number of workarounds. >> I couldn't even tell you if my languages support them and how well. > > That is a rather interesting thing to say! People often don't know all > the details of languages they use, but /usually/ the authors of those > languages have a fair idea of what they can do :-) (Yes, I know that > some of your languages were made a long time ago.) This can happen with little-used features, or ones you've forgotten about or never used. You tend to find them when overhauling code. However I think I first had nested functions by accident, by neglecting to disallow them.
Back to comp.lang.misc | Previous | Next — Previous in thread | Next in thread | Find similar
Algol 68 - formatting with fixed point format Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-08-23 06:49 +0200
Re: Algol 68 - formatting with fixed point format Andy Walker <anw@cuboid.co.uk> - 2025-08-23 15:22 +0100
Re: Algol 68 - formatting with fixed point format Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-08-23 17:49 +0200
Re: Algol 68 - formatting with fixed point format Andy Walker <anw@cuboid.co.uk> - 2025-08-24 00:58 +0100
Re: Algol 68 - formatting with fixed point format Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-08-25 01:49 +0200
Re: Algol 68 - formatting with fixed point format Andy Walker <anw@cuboid.co.uk> - 2025-08-26 23:53 +0100
Re: Algol 68 - formatting with fixed point format Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-08-23 19:28 +0200
Re: Algol 68 - formatting with fixed point format Andy Walker <anw@cuboid.co.uk> - 2025-08-24 00:27 +0100
Re: Algol 68 - formatting with fixed point format Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-08-24 02:49 +0000
Re: Algol 68 - formatting with fixed point format Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-08-25 01:57 +0200
Re: Algol 68 - formatting with fixed point format Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-08-25 02:14 +0200
Re: Algol 68 - formatting with fixed point format Andy Walker <anw@cuboid.co.uk> - 2025-08-27 00:58 +0100
Re: Algol 68 - formatting with fixed point format Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-08-27 08:23 +0200
Re: Algol 68 - formatting with fixed point format Andy Walker <anw@cuboid.co.uk> - 2025-08-27 23:23 +0100
Re: Algol 68 - formatting with fixed point format Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-08-28 07:35 +0200
Re: Algol 68 - formatting with fixed point format Andy Walker <anw@cuboid.co.uk> - 2025-08-29 00:43 +0100
Re: Algol 68 - formatting with fixed point format Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-08-30 05:40 +0200
Re: Algol 68 - formatting with fixed point format Andy Walker <anw@cuboid.co.uk> - 2025-08-30 20:38 +0100
Re: Algol 68 - formatting with fixed point format Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-08-31 10:10 +0200
Re: Algol 68 - formatting with fixed point format Andy Walker <anw@cuboid.co.uk> - 2025-09-01 17:20 +0100
Algol 68 / Genie - new release (was Re: Algol 68 - formatting with fixed point format) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-09-02 00:56 +0200
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-09-02 01:15 +0200
Re: Algol 68 / Genie - new release (was Re: Algol 68 - formatting with fixed point format) Andy Walker <anw@cuboid.co.uk> - 2025-09-02 17:02 +0100
Re: Algol 68 / Genie - new release (was Re: Algol 68 - formatting with fixed point format) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-09-02 22:17 +0200
Re: Algol 68 / Genie - new release (was Re: Algol 68 - formatting with fixed point format) Andy Walker <anw@cuboid.co.uk> - 2025-09-04 17:01 +0100
Re: Algol 68 / Genie - new release (was Re: Algol 68 - formatting with fixed point format) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-09-05 04:32 +0200
Re: Algol 68 / Genie - new release (was Re: Algol 68 - formatting with fixed point format) Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-09-02 23:04 +0000
Re: Algol 68 / Genie - new release (was Re: Algol 68 - formatting with fixed point format) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-09-03 01:46 +0200
Re: Algol 68 / Genie - new release (was Re: Algol 68 - formatting with fixed point format) Andy Walker <anw@cuboid.co.uk> - 2025-09-04 00:30 +0100
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-09-10 17:15 +0200
Re: Algol 68 / Genie - new release Andy Walker <anw@cuboid.co.uk> - 2025-09-10 23:57 +0100
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-09-11 07:27 +0200
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-09-11 09:42 +0200
Re: Algol 68 / Genie - new release Andy Walker <anw@cuboid.co.uk> - 2025-09-11 17:16 +0100
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-09-27 00:41 +0100
Re: Algol 68 / Genie - new release Andy Walker <anw@cuboid.co.uk> - 2025-09-27 14:38 +0100
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-09-29 01:15 +0100
Re: Algol 68 / Genie - new release Andy Walker <anw@cuboid.co.uk> - 2025-09-29 16:05 +0100
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-09-29 18:57 +0200
Re: Algol 68 / Genie - new release Andy Walker <anw@cuboid.co.uk> - 2025-09-30 15:58 +0100
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-09-30 17:48 +0200
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-09-29 19:08 +0100
Re: Algol 68 / Genie - new release Andy Walker <anw@cuboid.co.uk> - 2025-09-30 23:23 +0100
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-01 23:00 +0100
Re: Algol 68 / Genie - new release Andy Walker <anw@cuboid.co.uk> - 2025-10-02 16:55 +0100
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-02 21:51 +0000
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-04 12:38 +0100
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-04 14:04 +0200
Re: Algol 68 / Genie - new release Andy Walker <anw@cuboid.co.uk> - 2025-10-04 13:47 +0100
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-04 15:03 +0200
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-04 15:07 +0100
Re: Algol 68 / Genie - new release Andy Walker <anw@cuboid.co.uk> - 2025-10-04 18:40 +0100
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-04 19:46 +0100
Re: Algol 68 / Genie - new release Andy Walker <anw@cuboid.co.uk> - 2025-10-07 16:37 +0100
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-07 17:16 +0100
Re: Algol 68 / Genie - new release Andy Walker <anw@cuboid.co.uk> - 2025-10-07 23:58 +0100
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-08 01:20 +0200
Re: Algol 68 / Genie - new release Andy Walker <anw@cuboid.co.uk> - 2025-10-08 16:10 +0100
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-08 17:41 +0100
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-09 00:53 +0200
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-09 01:02 +0100
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-08 01:09 +0200
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-07 22:27 +0100
Re: Algol 68 / Genie - new release richard@cogsci.ed.ac.uk (Richard Tobin) - 2025-10-08 00:20 +0000
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-04 22:00 +0000
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-05 00:31 +0200
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-05 01:52 +0100
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-05 03:15 +0000
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-05 11:05 +0100
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-05 20:20 +0000
Re: Algol 68 / Genie - new release David Brown <david.brown@hesbynett.no> - 2025-10-06 09:44 +0200
Higher order functions (was Re: Algol 68 / Genie - new release) Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-06 10:01 +0200
Re: Higher order functions (was Re: Algol 68 / Genie - new release) David Brown <david.brown@hesbynett.no> - 2025-10-06 10:56 +0200
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-06 11:03 +0100
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-06 22:01 +0000
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-06 23:46 +0100
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-06 23:05 +0000
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-07 10:32 +0100
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-08 04:57 +0000
Re: Algol 68 / Genie - new release David Brown <david.brown@hesbynett.no> - 2025-10-05 13:24 +0200
Re: Algol 68 / Genie - new release antispam@fricas.org (Waldek Hebisch) - 2025-10-08 20:21 +0000
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-08 21:30 +0000
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-08 22:40 +0100
Re: Algol 68 / Genie - new release antispam@fricas.org (Waldek Hebisch) - 2025-10-10 04:18 +0000
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-10 16:21 +0100
Re: Algol 68 / Genie - new release antispam@fricas.org (Waldek Hebisch) - 2025-10-11 00:05 +0000
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-11 11:25 +0100
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-11 13:08 +0200
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-11 15:25 +0100
Re: Algol 68 / Genie - new release antispam@fricas.org (Waldek Hebisch) - 2025-10-11 12:39 +0000
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-09 00:34 +0200
Re: Algol 68 / Genie - new release antispam@fricas.org (Waldek Hebisch) - 2025-10-09 03:15 +0000
Re: Algol 68 / Genie - new release ram@zedat.fu-berlin.de (Stefan Ram) - 2025-10-09 08:59 +0000
Re: Algol 68 / Genie - new release antispam@fricas.org (Waldek Hebisch) - 2025-10-09 14:31 +0000
Re: Algol 68 / Genie - new release ram@zedat.fu-berlin.de (Stefan Ram) - 2025-10-09 14:53 +0000
Re: Algol 68 / Genie - new release ram@zedat.fu-berlin.de (Stefan Ram) - 2025-10-09 10:35 +0000
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-09 21:37 +0000
Re: Algol 68 / Genie - new release David Brown <david.brown@hesbynett.no> - 2025-10-10 17:40 +0200
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-10 20:04 +0100
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-10 21:45 +0000
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-11 00:29 +0100
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-11 00:16 +0000
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-11 01:59 +0100
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-11 01:42 +0000
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-11 10:42 +0100
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-31 06:51 +0000
Re: Algol 68 / Genie - new release David Brown <david.brown@hesbynett.no> - 2025-10-13 20:58 +0200
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-13 23:13 +0100
Re: Algol 68 / Genie - new release David Brown <david.brown@hesbynett.no> - 2025-10-14 00:39 +0200
Re: Algol 68 / Genie - new release antispam@fricas.org (Waldek Hebisch) - 2025-10-12 03:56 +0000
Re: Algol 68 / Genie - new release David Brown <david.brown@hesbynett.no> - 2025-10-13 22:38 +0200
Re: Algol 68 / Genie - new release antispam@fricas.org (Waldek Hebisch) - 2025-10-24 04:33 +0000
Re: Algol 68 / Genie - new release antispam@fricas.org (Waldek Hebisch) - 2025-10-03 22:24 +0000
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-04 03:39 +0000
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-04 12:19 +0100
Re: Algol 68 / Genie - new release Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-04 14:16 +0200
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-04 21:05 +0000
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-05 01:40 +0100
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-05 03:13 +0000
Re: Algol 68 / Genie - new release antispam@fricas.org (Waldek Hebisch) - 2025-10-05 01:29 +0000
Re: Algol 68 / Genie - new release Andy Walker <anw@cuboid.co.uk> - 2025-10-07 15:25 +0100
Re: Algol 68 / Genie - new release bart <bc@freeuk.com> - 2025-10-07 17:03 +0100
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-07 22:09 +0000
Re: Algol 68 / Genie - new release Adam Sampson <ats@offog.org> - 2025-10-08 18:22 +0100
Re: Algol 68 / Genie - new release Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-10-08 21:48 +0000
Re: Algol 68 / Genie - new release antispam@fricas.org (Waldek Hebisch) - 2025-10-08 23:45 +0000
Re: Algol 68 - formatting with fixed point format Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-08-30 06:54 +0200
Re: Algol 68 - formatting with fixed point format Andy Walker <anw@cuboid.co.uk> - 2025-08-31 00:44 +0100
Re: Algol 68 - formatting with fixed point format Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-08-31 08:12 +0000
Re: Algol 68 - formatting with fixed point format Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-08-31 10:42 +0200
Re: Algol 68 - formatting with fixed point format Andy Walker <anw@cuboid.co.uk> - 2025-09-01 00:10 +0100
Re: Algol 68 - formatting with fixed point format Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-09-01 07:30 +0000
Re: Algol 68 - formatting with fixed point format Andy Walker <anw@cuboid.co.uk> - 2025-09-01 16:13 +0100
Re: Algol 68 - formatting with fixed point format Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-09-01 22:41 +0000
Re: Algol 68 - formatting with fixed point format Andy Walker <anw@cuboid.co.uk> - 2025-09-02 14:23 +0100
Re: Algol 68 - formatting with fixed point format Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-09-02 23:08 +0000
Re: Algol 68 - formatting with fixed point format Andy Walker <anw@cuboid.co.uk> - 2025-09-04 00:54 +0100
Re: Algol 68 - formatting with fixed point format Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-08-31 10:29 +0200
Re: Algol 68 - formatting with fixed point format Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-08-24 02:47 +0000
csiph-web