I supose probably yes, but at the end I assume that internally mathematica has to use Set or SetDelayed. Am I right?
Background: I am developing a super simple phraser that takes a code description how objects should work and changes it slightly. Part of the code deals with assignments. They have to be handled in a somewhat special way.
The generic indexing works like
OBJ[id_]@f := f[id]
I noticed that during the assignments Mathematica does not bring
OBJ@f to the bitter end, i.e.,f`; for example in
OBJ@f = 1
the left hand side is not resolved to
I changed how
SetDelayed works for fields in objects, and would like to make sure that Mathematica always goes through my definitions:
OBJ /: Set[OBJ[id_]@f, rhs_] := (f[id] = rhs); OBJ /: SetDelayed[OBJ[id_]@f, rhs_] := (f[id] := rhs); OBJ /: OBJ[id_][f] := (f[id]);
the first two lines handle the cases like
OBJ@f = 1; OBJ@f := 2;
while the third line handles the cases like
a = 2 * OBJ@f + 1
of course, a combination is possible:
OBJ@f = OBJ@f + 1;
I am providing the background to the question, which should hopefully put the question in the right context. Hope someone can help.