Scriptlike v0.9.4 - Perl-like interpolated strings, full examples and more


New update to Scriptlike: v0.9.4.

Scriptlike is a library to help you write script-like programs in D.

The two highlights in this release are string interpolation and a full set of examples in the documentation. Also of note are the new functions removePath and tryRemovePath which can be used to delete files (like remove) or directories (like rmdirRecurse).

For the full list of all changes in this release, see the changelog.

String Interpolation

See: https://github.com/Abscissa/scriptlike#string-interpolation

AFAICT, a string mixin is necessary to accomplish this in D, but otherwise it works much like other languages:

// Output: The number 21 doubled is 42! int num = 21; writeln( mixin(interp!"The number ${num} doubled is ${num * 2}!") );

The interpolated sections are handled via std.conv.text(), so they accept any type.

Bikeshedding requested! I'm not 100% sold on the name interp for this long-term. Suggestions welcome.

Examples

The homepage/readme now provides sample code demonstrating all of Scriptlike's various features.

There is also a demonstration of suggested practices for how to use Scriptlike in a D-based script.

And finally, all examples are included as actual runnable programs (all automatically tested by dub test, to ensure continued freshness).

Leave a comment

Captcha