There's a strong adverse selection effect, though. Because you need to publish to be granted a patent but can sue whenever anyone infringes (whether willful or not), the incentive is to patent obvious approaches that don't work well and hold the best approach that you're actually using as a trade secret. That way, anyone attempting to replicate you likely ends up in a patent minefield, yet you don't give away the keys to the castle in a patent where you have to detect infringement yourself.