Daniel Davidson:

I am using Dart for code generation but would like to consider D if I can find a convenient replacement for the following declarative style:

Replacing Dart with D seems quite strange, such two languages have so much different usage niches.


    var dateRange = struct('date_range')
      ..doc = 'Basic pair of start and end dates'
      ..unitTest = true
      ..publicSection = true
      ..members = [
        member('start_date')
        ..type = 'Date',
        member('end_date')
        ..type = 'Date',
      ];

A similar syntax is not allowed in D, but there are two things that help for this: the C-style initialization of structs, that support field names too, and the with(){} statement.

Bye,
bearophile

Reply via email to