I've discovered a bug with the Surface Label (22 & 23) that makes it unreliable in practical usage: it will read the opposite of the wall if the wall direction is flipped.
1. Draw a wall with different surfaces outside and inside
2. Apply the Surface Label
3. Under General Settings of the label, choose "Wall Outside Face Surface" as Surface to Display
4. Hit Enter, and note which surface it's returning
5. Flip the wall direction (Edit > Reference Line and Plane > Invert Wall Direction). It will now be returning the surface for the opposite side
I have tried creating my own label reading WALL_MAT_A and WALL_MAT_B and it does the same thing - so something's fishy about the values Archicad is returning, not the surface label itself.
Odd thing is, if you just place a text label with Autotext content of "Outside Face Surface" or "Inside Face Surface", this doesn't happen.
predictable use of the wall label forces the user to prefer walls whose reference vector is drawn / oriented in a clockwise fashion. I'm not sure if this is a hurdle, but it's fafaster to modify the wall than to flip the label.
The label problem that needs fixing is having a predictable behaviour when mirroring plans.
The only advantage of this swapped values I can think of, is that when you have a wall with its reference line in the center with two labels, one display the outside surface and the other inside. When you "Flip Wall on Reference Line", the wall and both labels stay in the same location but the values are changed without having to go into the label's setting to change what to display (outside/inside).
If you write your own GDL, there's another situation that WALL_MAT_A and WALL_MAT_B return swapped values is with slanted wall. What I found out is that it has something to do with flip status (WALL_FLIPPED). You might want to take this into account in your code.