FOOP references: advantages and disadvantages
Posted: Fri Aug 28, 2015 3:32 am
Advantages and disadvantages of FOOP references
- FOOP related:
- reuse of FOOP funcs, instead of using bloated mixed-in contexts;
- context related: state change transfer of FOOP from callee to caller by call parameter, without the need to share a var located somewhere outside callees func definition;
- both together: selected API funcs for direct access as part of FOOP's reference context, to have a separation of API and other code.
- FOOP references are polluting MAIN namespace;
- no automated garbage collection of FOOP reference contexts (but it's no problem to provide a delete method - e.g. as part of FOOPReference class, which has created them - iterating over all ref context instances easing this);
- call-by-ref has problems, which call-by-value does not have.
- FOOP references may be used for shared FOOP objects with many and/or much code containing FOOP funcs, which is typically for 'heavy' objects not occuring in a big number (a usecase described in another post is multiple loggers).
- Call-by-ref has usecases.
- The usefulness of using FOOP reference contexts as API to FOOPs - e.g. (foopRef:some-func) -> (:some-func foopRef) (some-func located in separate contexts here!) - has to be explored yet.
- Convenience funcs for calling FOOPs like contexts - this is related to the previous point - can be helpful (e.g. for transparently having the same API after switching from a single context to FOOPReferences).