- Feature Name: refactor_stdlib
- Start Date:
- RFC PR: https://github.com/Whiley/RFCs/pull/7
- Tracking Issue: https://github.com/Whiley/RFCs/issues/10
This proposals a simple refactoring of the Whiley standard library to bring it more inline with other systems languages.
The Whiley Standard Library currently consists of the following modules:
whiley.io.File whiley.io.Reader whiley.io.Writer whiley.lang.Any whiley.lang.Array whiley.lang.ASCII whiley.lang.Byte whiley.lang.Int whiley.lang.Math whiley.lang.Stack whiley.lang.System
This package structure is designed along the lines of Java's standard library. However, given the focus of Whiley as a systems language, it seems more appropriate to follow the structure of other similar languages (e.g. Rust, C, C++, D). Furthermore, instead of imagining a large system library, it seems more prudent to imagine a small library. A "flatter"package structure would reflect this. As such, the proposed package structure is:
std.ascii--- For all ASCII related stuff. This is simply a renaming of
std.io--- For all basic definitions of readers / writers. This merges
std.array--- For all array manipulation functions. This is simply a renaming of
std.int--- For all integer coercion operations, and other functions (e.g. parsing integer from string). This is simply a renaming of
std.math--- For all math related functions, e.g.
gcd(), etc. This is simply a renaming of
In addition, we would image the following additional package in the future:
std.utf--- Providing various utilities for working with UTF strings and encodings.
std.collections--- Providing various commonly used data structures (e.g.
std.net--- Providing various networking primitives, of which some notion of a
socketwould be most notable.
std.fs--- Providing various filesystem primitives, such as for reading/writing files and listing directories, etc.
std.time--- Providing various facilities for accessing the system clock, and representing units of measure, etc.
std.date--- Providing various facilities for reasoning about dates and timezones.
What is lacking from proposed structure above is support for a wider
range of file formats. For example, the D standard library (phobos)
includes support for
zip, and more. Whether
or not such formats should be supported in WySTD remains to considered
in the future.
None. This is a simple refactoring of the existing code base.
Drawbacks and Limitations
- Backwards Compatibility. Of course, many existing programs would no longer compile.