The law should not ban asking for previous salaries, but it should compel employers to disclose current salaries of other employees at the firm so that the applicant can effectively negotiate. Employers who don't wish to do this must be scared of what a level negotiation looks like, which is evidence enough that they should be compelled to have one.
Exactly.
As soon as you publish salaries, employees will demand equal pay for equal work and companies will be forced to repair the gap or risk losing or not attracting valuable talent.
Example from the Netherlands, 10 years ago a maximum salary was set for work in (semi-)public sector. Think city and healthcare managers. The result was that everyone under that amount became motivated to reach it. Before that they had no idea what was possible, there was no obvious goal, so many were content at where they were.