Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4363

User-extensible type mappings

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • D - Compiler, D - Library
    • None

    Description

      One of the most common types I deal with is a datetime. Another common type is a time delta. It would be great if these were built in, but that's unlikely to happen soon. Another option is to put this into the library as a relatively generic thing: use an annotation to tell the compiler what D type this thing is, and then have the library figure out how to convert the format given to the requested type, in a way where the user can override things.

      For instance, I have a Timestamp type. It's got an int64 for the epoch second and an int64 for the nanosecond. I want to turn that into a std.datetime.DateTime. Optionally, the library can possibly look for a way to build a DateTime from those components automatically. It won't find one, so it will produce a fallback that simply produces a reasonable exception. I can provide a manual converter on application startup.

      This lets me have a generated object model that looks more like what I would have written by hand.

      Attachments

        Activity

          People

            Unassigned Unassigned
            dhasenan Neia Neutuladh
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: