In the context of a class form, what’s the difference between define and define/private? They both seem to define identifiers that are inaccessible from outside the class and can’t be inherited in subclasses.
@michaelmmacleod In a class, define will create a private field which will be created for each instance of a class, whereas define/private is used to create private methods, so they’re shared by all objects a given class
To add some extra detail to what Dan said, (define (f) ...) will create a private field that contains a lambda that closes over this (and the init args), so the closure will be reallocated every time the class is instantiated.
Thanks, that makes sense now. I guess I’ll try to use define/private whenever possible to avoid excess allocation.
I’d bet it’s not actually a very important difference unless you’re making a lot of objects.