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

Format, Layout, TextFormat

Moderators: larsivi kris

Posted: 02/26/07 00:26:06

The global Formatter object is gone.

How shall an application handle an Formatter instance?

Shall it make its own, global instance?

Shall a lib have its own instance also?

Can Tango provide a mechanism to hold the instance for both (app & libs).

TextFormat? used the Format, now it uses Layout.

Does that change anything?

Can I simply make a global Layout object and replace all

new TextFormat!(char)(Formatter,new Buffer(file))

with

new TextFormat!(char)(Layouter,new Buffer(file))

? Or does this change behaviour?

Author Message

Posted: 02/26/07 19:57:58

The global Formatter object is gone.

How shall an application handle an Formatter instance?

Shall it make its own, global instance?

Shall a lib have its own instance also?

Can Tango provide a mechanism to hold the instance for both (app & libs).

TextFormat? used the Format, now it uses Layout.

Does that change anything?

Can I simply make a global Layout object and replace all

new TextFormat!(char)(Formatter,new Buffer(file))

with

new TextFormat!(char)(Layouter,new Buffer(file))

? Or does this change behaviour?

The global Formatter is gone due to lib issues. One quick way to get access is via Stdout.layout() which exposes the formatter used by Stdout. You can, for example, use that for string-printing: Stdout.layout.sprint()

An application can create whatever TextFormat? instances it likes, and bind then to whatever Layout and Buffer instances are appropriate. Going forward, TextFormat? will also support the full I18N extensions, via a change to the Layout argument; that part will be a seamless transition.

In the meantime, TextFormat? will probably migrate to tango.text somewhere, as a distinct entity (away from Stdout)

Posted: 03/01/07 20:16:25

tango.io.TextFormat? has been renamed to tango.io.Print.

In other news, the i18n support from tango.text.locale has been tied into the IO system: you can use a tango.text.locale.Locale instance in place of a Layout instance when using Print, and you can configure Stdout to use a Locale of choice.