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

Changes in 0.99.4

We made a number of breaking changes in this release, in order to get them over and done with. These are the affected areas:

FilePath

  • Instead of supporting '\' on Win32 and '/' on other OS, FilePath now supports '/' across all. Internally, all path separators are normalized to '/' and there's a method exposed to convert back to a platform-specific version as necessary (called native). We did this to ensure the VFS is consistent at all times. FilePath now has one of the ctors deprecated due to this change.

String

  • The String class was deprecated in the prior release in favour of using Text instead. This is done for the sake of compatibility with phobos in the toString() name conventions. String is removed in this release, so replace with Text instead.

DataStream

  • write/read changed to put/get

toUtf8/16/32

  • Has become toString, toString16, toString32
  • Potentially aliased as toStringW + toStringD also (if we can easily do that)

Float

  • Float.format and related functions used to accept an optional (defaulted) boolean trailing argument, indicating scientific notation. This is now an integer specifying the maximum exp before a switch should be made to said notation. Set to 0 in order to force notation; the default value is currently 10.

MemoryConduit

  • Was previously deprecated, and is now removed. Please use tango.io.GrowBuffer instead

Time Representation

  • The tango.util.time package has been restructured and moved. The package now resides in tango.time instead of tango.util.time, per the request of users. See this page for updated documentation. Oft-used data structures have all been placed within one module called tango.time.Time
  • tango.core.Type has been removed, which means Interval and the original Time type no longer exist. Any place that used Interval in tango.core.* for timing purposes (sleeping, waiting, etc.) now takes a double instead. This is what Interval used to represent, so the semantics have not changed here.
  • A new struct TimeSpan (in tango.time) has been introduced that replaces Interval in all packages outside core, and places where Time was previously used as a length of time should likely use TimeSpan instead.
  • If you used the original Time type to represent a point in time, replace it with the new Time type. Use TimeSpan instead of Time where you are representing a span instead of a point in time.
  • DateTime was migrated to the Time type.
  • Time is now used only to represent points in time. Differences between two Time points are now represented by a TimeSpan. This is reflected in the return values and parameters of the Time math operators. For example, you can no longer add 2 Time values together, but you can add a Time and a TimeSpan. Many of the Time.addXXX functions have been deprecated or removed. Instead you should use x += TimeSpan.XXX. For example:
    // add 5 day to current date/time
    Time x = Clock.now;
    x = x.addDays(5); // old way
    x += TimeSpan.days(5); // new way
    

  • Time.now, Time.today and Time.utc have been removed. Import the Clock and WallClock modules directly and use Clock.now or WallClock.now.
  • Functions for dealing with components of time alone, sans date, have been isolated into a TimeOfDay struct. Thus, to operate with the (modulo) minutes of the current time:
    TimeOfDay time = Clock.now.time;
    assert (time.minutes < 60);
    
  • Functions for dealing with components of date+time have been isolated into the TimeSpan struct, as noted previously. Contrast the above example with this one which operates with the number of minutes since the epoch:
    TimeSpan span = Clock.now.span;
    assert (span.minutes > 60);  // this is the year 2007, so minutes should be a big number!
    
  • Calendar functions in the original DateTime have been removed from the new Time type. This is to reduce the duplication of code in Time and Calendar. The Time type has accessors for the components of the time of day (as illustrated above), but other Calendar-like components should be accessed through Calendar's methods. For example, to get the year a Time represents, use the Calendar.getYear(Time) function.
  • Time.min is now negative, and there's a new Time.epoch representing what min used to be. The library will appropriately handle negative times as we move forward.
  • Various time-related http classes are now Time based, and the default values are Time.epoch rather than Time.min.
  • HttpClient has a deprecated function related to this, as does SocketConduit