This is due to pattern matching. If you use a lowercase name according to the pattern:
reactions += { case EditDone(fahrenheit) =>
then the object being mapped (an event in this case) will be mapped to any EditDone event for any widget. It will link the widget link to fahrenheit . fahrenheit becomes a new value in the scope of this event.
However, if you use backlinks:
val fahrenheit = new TextField ... reactions += { case EditDone(`fahrenheit`) =>
then matching the pattern will succeed only if the EditDone event refers to an existing object referenced by the fahrenheit value defined earlier.
Note that if the name of the fahrenheit value was uppercase, for example fahrenheit , then you would not have to use backreferences - it would be as if you put them. This is useful if you have constants or objects in the area that you want to map to - they usually have upper case names.
axel22
source share