Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utcs!mnetor!seismo!caip!princeton!allegra!ulysses!mhuxr!mhuxt!houxm!ihnp4!inuxc!pur-ee!uiucdcs!ccvaxa!aglew From: aglew@ccvaxa.UUCP Newsgroups: net.lang Subject: Proc types Message-ID: <800016@ccvaxa> Date: Sun, 13-Jul-86 11:48:00 EDT Article-I.D.: ccvaxa.800016 Posted: Sun Jul 13 11:48:00 1986 Date-Received: Mon, 14-Jul-86 22:28:18 EDT Lines: 44 Nf-ID: #N:ccvaxa:800016:000:1678 Nf-From: ccvaxa.UUCP!aglew Jul 13 10:48:00 1986 The discussion about how to implement pointers to functions with enumerated classes in Ada got me to thinking... I really like pointers to functions. Don't take them away. Of course, I want full specification of argument types, even varargs... However, sometimes a pointer to a whole class of functions is too loose. It would be nice to be able to constrain it further. Eg. instead of all int(int)s, only to particular int(int) functions (that you know maintain the necessary invariant?...) You can do this with a type declaration for those particular int(int)s you will permit, but (1) types proliferate, and it can be damned hard to invent a meaningful name for a type that you're using on an ad-hoc basis, and (2) this may constrain sharing functions between modules that might require a different type-name. Also (3) it violates a rule that I am fond of in language design: if you can bind something to a symbol, then it should be possible to replace uses of that symbol by some literal. So, what I'm looking for in this situation is something like (veuillez excusez my mixture of langages) VAR p: POINTER TO int(int) FROM { func1, func2, func3 ... } or TYPE p = POINTER TO int(int) SATISFYING constraint; where you might declare that you have satisfied the constraint at the procedure body: PROCEDURE func1(int a) RETURNS int SATISFIES constraint; In many ways this is like the problem of specifying non-contiguous subsets of the integers as types. Has anyone seen languages that do something like this? Andy "Krazy" Glew. Gould CSD-Urbana. USEnet: ihnp4!uiucdcs!ccvaxa!aglew 1101 E. University, Urbana, IL 61801 ARPAnet: aglew@gswd-vms