On Saturday, 25 November 2017 at 09:39:15 UTC, Dave Jones wrote:
I mean at the end of the day, that would turn a run time error into a compile time error which is a good thing isnt it?

Debatable in this case. Consider:

string servicePhoneNumber;

final switch (car.manufacturer) //an enumerated value.
{   case CarMaker.Audi:
        servicePhoneNumber = staff["Dorff Hans"].phone;
        //...
    break;
    case CarMaker.Skoda:
        servicePhoneNumber = staff["Telegin Svetlana"].phone;
        //...
    break;
    //more cases ...
}

Here it is arguably unnecessary typing if you had to manually set servicePhoneNumber to "" or something at start. And in case of structs it tends to be a verbose thing to manually set one to it's init value.
            • Re: Fl... A Guy With a Question via Digitalmars-d-learn
            • Re: Fl... Adam D. Ruppe via Digitalmars-d-learn
              • Re... A Guy With a Question via Digitalmars-d-learn
              • Re... Steven Schveighoffer via Digitalmars-d-learn
              • Re... Adam D. Ruppe via Digitalmars-d-learn
              • Re... Michael V. Franklin via Digitalmars-d-learn
              • Re... Michael V. Franklin via Digitalmars-d-learn
              • Re... A Guy With a Question via Digitalmars-d-learn
              • Re... Michael V. Franklin via Digitalmars-d-learn
              • Re... A Guy With a Question via Digitalmars-d-learn
          • Re: Floatin... Dukc via Digitalmars-d-learn
            • Re: Fl... Adam D. Ruppe via Digitalmars-d-learn
        • Re: Floating po... Ola Fosheim Grøstad via Digitalmars-d-learn
  • Re: Floating point types def... codephantom via Digitalmars-d-learn

Reply via email to