Thank you for you answer!  I'll need to think more about it.  The idea of 
having structs whose fields contain functions has never occurred to me, but 
it may actually fit my relatively simple use case (and the planned 
migration to Typed Racket).

-
Sergiu
On Sunday, November 8, 2020 at 8:22:16 PM UTC+1 jackh...@gmail.com wrote:

> The typical use case for classes in Racket is writing GUIs, and that's 
> mostly because the GUI framework is class based.
>
> For most other use cases, generics are a better choice than classes. 
> They're simpler and have a less intrusive effect on your API surface. If 
> you don't need to support arbitrary user implementations, you can avoid 
> generics and classes altogether and use structs whose fields contain 
> functions.
>
> On Sunday, November 8, 2020 at 6:12:37 AM UTC-8 unlimitedscolobb wrote:
>
>> Hi,
>>
>> A general knowledge question: what would be the typical use cases of 
>> Racket generics vs. the typical use cases of Racket classes?
>>
>> Am I correct in assuming that I can do everything with classes what I 
>> could do with generics, and that generics have made their way into the 
>> language before the classes?
>>
>> -
>> Sergiu
>>
>> P.S. I'm reading the section on classes in the updated Typed Racket 
>> reference, and I'm very happy to see this new functionality!  Very good job 
>> the Typed Racket Team!
>>
>

-- 
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 racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/dccc148b-6f20-42c0-a5bf-c5a7f42b3bd2n%40googlegroups.com.

Reply via email to