It is operating in a task force, that is true, but the level of specialization that you are talking about is not viable. Ships are required to carry out both individual tasks and group actions, so I will address the specialization in both contexts.
Individual: This should be fairly obvious. A ship that is devoted to ASW or AA combat is going to be utterly devestated when they are tasked with facing a situation that does not play to their strengths. A common task assigned to a destroyer, for instance, is that of sea lane patrol and vessel interdiction. If the destroyer is a devoted anti-aircraft ship, there would be very little they could do when faced with even minimal armed resistance.
Group: Even in the context of a group, there are notable disadvantages. Should one of the ships be destroyed, then the type of power that ship is specifically assigned to provide is greatly reduced. A smart foe will then exploit that and follow up with attacks focused on the area the lost ship was powerful in. In contrast, if every ship able to perform in most areas then only the average power is reduced. (as opposed to both average power and area-specific power being lost with the specialist ship) Not only that, but when you take into account the fact that ships are assigned a variety of roles even within the context of the task force (cruisers can fufill the role of air defense, surface engagement, and ASW defense) they can be used to supplement one or several weakened areas in another group without creating specific weaknesses in the aiding group.
Mind, I am not trying to say specialization is bad, just that overspecialization is. There are specialized ships in the navy, but there are no ships that are devoid of power in vital combat areas.
Now, something you mentioned was that CVNs can exist without weilding combined arms themselves. This is only viable due to the fact that they are massively multi-purpose as well. How? Their aircraft, of course. They carry air superiority fighters, mud movers, ASW/ASuW choppers, and recon rovers. These can all deploy as independent forces and be assigned to a specific area; however, when viewed in the context of launching from the carrier it shows the carrier to be an extremely generalized ship. Notice, however, that even though they are powerful and generalist that they are deployed with other warships. Those other warships are, basically, yet another extension of their generalist power. They are C3/C4 ships, and as such their surrounding battlegroup should be considered in the same light as their aircraft: extensions of their power.
[OOC: I know. But honestly, what is more wanktastic than being able to fight well against
everything, eh?
]