Hacker News new | past | comments | ask | show | jobs | submit login

Isn't the first C# example (the class) a pessimization? Why not e.g.

    public class CircleMeasurement
    {
        public double Diameter { get; private set }
        public double Area { get; private set }
        public double Circumference { get; private set }
        public CircleMeasurement(double diameter, double area, double circumference)
        {
            Diameter = diameter;
            Area = area;
            Circumference = circumference;
        }
    }
Arguably there's still a fair bit of repetition due to the constructor, compared to the F# code (and I'm not sure object initializers can be used with private-set properties), but a third of the repetitions have been skipped through implicit backing fields.



And he didn't even implement equality and comparison yet!


Also most of that code can be written automatically with Resharper...


Resharper isn't going to read it for you.


This. I love IDEs, but arguments like 'the tool can generate $GARBLE for me!' are what keeps the haters a-hatin' and the mediocre programmers mediocre.




Applications are open for YC Winter 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: