Codiagonals in @program macro that are not returned
The @program macro allows for very easy wiring directed wiring diagram generation, but there are certain wiring diagrams it cannot express. For example, I'd like the following program to return a and merge inputs b and c
@program C (a::X,b::X,c::X) begin
[b, c]
return a
end
However, it just returns a. Any codiagonal that doesn't somehow make it to the final return expression gets ignored, it seems.
@program C (a::X,b::X,c::X) begin
return (a, [b, c])
end
This program almost gives us what we want, but it has b (which equals c) as an output that we don't want. A current workaround is to generate wiring diagrams like this and then trim off outputs that weren't actually desired from the ACSet.
(There's a dual issue when we want to create cups rather than caps, requiring us to create artificial inputs which then must be 'trimmed' at the end, too.)
The reason for this that the @program macro assumes that the biproduct laws are in effect when combining the product and coproduct structures. (I'm not sure whether this is documented.) The law at work here is

which says that merging and then deleting is the same as just deleting the two inputs. So what you are seeing is expected behavior.
We could have a variant of the program macro with different behavior. It sounds like you are asking for a version where you can express caps and cups?
Make sense! And yeah, that sounds right. So this is definitely more of a feature request than a bug.