Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Abstract Syntax Tree for C programs Date: Wed, 05 Jun 2019 12:56:38 -0700 Organization: None to speak of Lines: 22 Message-ID: References: <87ftop38c1.fsf@bsb.me.uk> <98193656-76f0-4718-9a97-a24ba0aa9b7c@googlegroups.com> <4ff90bb7-33e5-4dcd-828f-b0d40f237420@googlegroups.com> <8a72685f-2774-4187-98bf-c9ecd44b3240@googlegroups.com> <6ed2dfc1-a737-4fb3-b59a-3aa1c337061d@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="2e5690e26a3a02612d58fbc15f6a6031"; logging-data="32232"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX188bn79TtQ0MN28FRKt5ZbO" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:EGqUjDbCtFeTSDA3zx4ttJb2E8A= sha1:6Wan4xEjbnKLMpfXHtX+ex6YmLw= Xref: csiph.com comp.lang.c:144497 David Brown writes: > On 05/06/2019 20:36, bart4858@gmail.com wrote: [...] >> There's no language where a generic function pointer can be >> represented by a type simpler than 'void(*)(void)'? > > I don't know of many programming languages that have generic function > pointers at all. Arguably Perl does. A reference to a subroutine can be used to call any subroutine. Perl subroutines do not (usually) have type information; any arguments are passed as a list of zero or more scalars, each of which can be a number, a string, a reference, etc. It's easy to write a Perl subroutine that can accept and process, for example, either four numbers or one string. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Will write code for food. void Void(void) { Void(); } /* The recursive call of the void */