There are a number of reasons why companies like to keep salaries a secret. The competitor angle is one. A big one: The general rule is that the first one to offer a number loses. For example, if you tell me your salary range is $75k-$90k, I can feel pretty safe telling you that I'm looking for $105k but your company is so awesome that I might just be willing to give up a bit in exchange for $AWESOME_PERK. Thus disclosing what you're willing to pay in your job listing puts you at an immediate disadvantage when the negotiation comes up.
"I'm looking for $105k but your company is so awesome that I might just be willing to give up a bit in exchange for $AWESOME_PERK."
Good luck negotiating that unless you are in high demand. Also I don't quite follow your argument. The only disadvantage of disclosing salary could be the fact that the candidate is aware of how high they ca go in a negotiation. But if the job is well priced, that should not matter.
I personally like to know the range because I do not want to waste my time with low ballers or waste the hiring manager's time by expecting something that they cannot match.
I was under the impression that we were talking about programming jobs (since this is Hacker News) — if so, then yes, you're in pretty high demand. You'll notice that job listings at, say, McDonalds or grocery chains do tend to mention the pay.