In each AST node translation, you know for each value which one to use.
For example, when translating a return, the value to return needs to be pushed on stack, so the valueTranslator is used:
visitReturnNode: aReturnNode��
valueTranslator visitNode: aReturnNode value.
methodBuilder returnTop.
Yet, in #visitMethodNode:, you can see that the effectTranslator is used, because no value is pushed on stack at the end of the method body:
...effectTranslator visitNode: aMethodNode body...
Then some behavior can be conditional, for example, in��OCASTTranslator >> #visitArrayNode:��
...^ self visitLargeArrayNode: anArrayNode ]...
The self here represents either the value or effect translator and dispatches to the correct method using polymorphism.
| when do I know that I need to use ?
If you need the value on stack, use the valueTranslator.
If you need the effect but not the value, use the effectTranslator.
If you're implementing something in the valueTranslator, it needs to push something on stack at the end.
If you're implementing something in the effectTranslator, it doesn't push anything on stack at the end.
|����the effect translator only or the value translator?