Section 37. If a city by its city council or a town accepts this section or has accepted corresponding provisions of earlier laws, a building line not more than forty feet distant from the exterior line of a highway or town way may be established in the manner provided for laying out ways, and thereafter no structures shall be erected or maintained between such building line and such way, except steps, windows, porticos, other usual projections appurtenant to the front wall of a building, embankments, walls, fences and gates, to the extent prescribed in the vote establishing such building line, and except that any structure existing at the time of the establishment of the building line may be permitted to remain and to be maintained to such extent and under such conditions as may be prescribed in the vote establishing such building line. Whoever sustains damage thereby may recover the same under chapter seventy-nine. A building line established under this section may be discontinued in the manner provided for the discontinuance of a highway or town way. Whoever sustains damages by the discontinuance of a building line may recover the same under chapter seventy-nine.