I'm glad, I didn't expect my comment to be so helpful :)

For those curious, I have several examples of this pattern in Rebellion. 
The following constructs are all just structs of functions:

   - Comparators <https://docs.racket-lang.org/rebellion/Comparators.html>
   - Converters <https://docs.racket-lang.org/rebellion/Converters.html>
   - Equivalence relations 
   <https://docs.racket-lang.org/rebellion/Equivalence_Relations.html>
   - Reducers <https://docs.racket-lang.org/rebellion/Reducers.html>
   - Transducers <https://docs.racket-lang.org/rebellion/Transducers.html>

On Monday, November 9, 2020 at 2:03:52 AM UTC-8 unlimitedscolobb wrote:

> On Monday, November 9, 2020 at 1:51:05 AM UTC+1 Kieron Hardy wrote:
>
>>
>> > On Nov 8, 2020, at 2:58 PM, Hendrik Boom <[email protected]> 
>> wrote: 
>> > 
>> >> On Sun, Nov 08, 2020 at 12:47:11PM -0800, unlimitedscolobb wrote: 
>> >> The idea of having structs whose fields contain functions has never 
>> occurred to me ... 
>> > 
>> > Historical note: 
>> > 
>> > I first encountered structures containing function in the source code 
>> for 
>> > OS/360 way back in the late 60's. In assembler. 
>> > 
>>
> Structures with fields containing functions has never occurred to me 
>> before, either, at least not in those terms. 
>>
>> However isn’t that exactly one of the key design principles behind how 
>> device-drivers are implemented and installed into an OS? And also how 
>> classes and objects were initially added to C as some pretty hairy #define 
>> macros and function pointers? 
>>
>> This design pattern insight would have been beneficial to me sooner - 
>> doh! 
>>
>>  
> I completely share your feelings Kieron.  In fact, I have already defined 
> structures with functions in the fields multiple times and in many 
> programming languages, but I have never thought how this pattern could be 
> used to implement generic-like functionality :D
>
> Thank you Hendrik for the historical note!
>
> -
> Sergiu
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/15dc0d41-dbd2-488a-9113-31c284443ce4n%40googlegroups.com.

Reply via email to