Firstly I should say I am not 100% up to speed on how to do configs etc but I do have some knowledge of SQF so this may be completely impossible. However...
Could a simple way of doing this just be for the weapon to accept anything that is extending that class? For example you could have a base "holosight" class that the weapon will accept and anything derived from that class. I guess if that was possible it could be done in multiple ways like instead of "holosight" as the base class it could just be a rail type.
I feel this way would allow people to specify types of sights that their guns can mount so they can prevent other types if they wish.
On top of that I think a system like this would make it easier for other attachments, for example if someone wanted to model varying types of flashlight that can be mounted onto any gun that accepts a flashlight they would be able to with ease.
Sorry this note is a bit long but that is just my personal opinion on how this problem could be solved from a technical point of view. No idea if its even possible within ArmA.