Minecraft makes use of unique blocks that exist int he program as block ID's for each block space occupied by something (fixed/static) in the game (with the exception of dropped items, boats, minecarts, MOBs, players, and weather effects like rain/snow).
Typically, the game is not designed to allow multiple blocks to co-exist in the same block space, as this is how the game determines where everything is located in the world and how it impacts the environment.
Generally, this works pretty well for most things...except where 'carpet blocks' are concerned.
Let me touch really briefly on what a carpet block is, obviously, there is (Colored) Carpet, but there is also Snow (Carpet). And it is debatable as to whether minecart rails, flowing water, flowing lava, redstone dust, etc. would be included in this category... for the sake of this discussion, I'm excluding these and just considering the 'wool' and 'snow' carpets and anything new that might come about that would be similar to these (carpet of leaves was suggested in another thread dedicated to season changes).
As it is, we can carpet a floor, but we can't put a torch in the same block space as the carpet block, nor can we put a fence post (frequently used for tables) or carpet under a door at this time. Also, we can't effectively carpet on top of stairs or 'lower' half-slabs either.
If it snows outside, that snow carpet cannot occupy the same space as a fence, or tall grass, or a flower, but would layer on top of it (if at all).
One of the advantages of Object Oriented Programming languages is object inheritance. And this can be applied recursively for an object to inherit itself as part of its own traits.
So what can be done is that the Carpet block can be setup as a block that inherits another block type as a secondary block.
Usually, the carpet block would just have an 'air' block (or empty block) that it shares space with, in most cases. but if it was shared with a fence block, then the carpet would appear to go under the fence, while still allowing the fence post to exist there. Snow could cover the ground around fences and fence gates, and even have a light covering on top of those same fences and gates. Carpet could go under the thresholds of doors, and have torches occupying the same space, and might even be able to hide redstone dust trails that are going on top of the floor. You would be able to carpet stairs and slabs regardless if they were the lower or the upper half.