Preheat oven to 350°F (175°C). Grease a 9-inch pie dish.
In a large mixing bowl, combine the sugar, flour, and salt.
Add the eggs and beat well. Then, stir in the milk, melted butter, and vanilla extract until smooth.
If using, fold in the shredded coconut.
Pour the batter into the prepared pie dish.
Bake for 50-60 minutes, or until the pie is set and golden brown on top. A knife inserted into the center should come out clean.
Let the pie cool completely before slicing. Serve chilled or at room temperature.