Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #566 (closed enhancement: fixed)

Opened 5 years ago

Last modified 4 years ago

Formatting more types

Reported by: JarrettBillingsley Assigned to: kris
Priority: major Milestone: 0.99.4
Component: Core Functionality Version: 0.99 RC3 Xammy
Keywords: Cc: JarrettBillingsley, Deewiant

Description

tango.text.layout.Convert fails to format some rather important types.

1) Arrays. 2) AAs. 3) Structs.

The last one brings us tangentially to another Tango design decision. The compiler inserts helper code for the toString method of structs in TypeInfo?_Struct.xtoString. If the struct defines a toString method, it's non-null; if not, you can just output {unhandled argument type}. Of course, the Tango Way (TM) is toUtf8, but that's been met with considerable opposition.. that's not what this ticket's about though.

Lastly, it formats pointers as decimal numbers. Could they be hex instead, possibly defaulting to padded to 8 chars wide on 32-bit and 16 chars on 64-bit?

Change History

08/08/07 11:34:43 changed by JarrettBillingsley

  • cc set to JarrettBillingsley.

08/08/07 16:20:22 changed by sean

  • owner changed from sean to kris.

08/17/07 13:28:46 changed by kris

yeah, arrays will be supported. Structs are a known pain, and we hope to rectify that somehow via the conference. Can you format your pointers using {:x8}

08/17/07 14:43:31 changed by Deewiant

  • cc changed from JarrettBillingsley to JarrettBillingsley, Deewiant.

Another one: there's no way to format an integer as a char, like the %c specifier for printf.

This is annoying when I want to take advantage of positional specifiers: Stdout.formatln("{} {0:x} {}", integer, cast(char)integer) currently requires the cast to char. I'd prefer Stdout.formatln("{} {0:x} {0:c}", integer) or equivalent.

08/26/07 16:25:41 changed by kris

  • status changed from new to assigned.

not forgotten :)

11/25/07 02:13:30 changed by kris

  • status changed from assigned to closed.
  • resolution set to fixed.
  • milestone changed from 1.0 to 0.99.4.

Array support was included recently by keinfarbton, and Tango now uses toString. Sorry you had to wait so long for this