On Wednesday, 23 December 2015 at 20:56:39 UTC, Basile B. wrote:
This is not available in the grammar. You can still open a
duplicate enhancement request.
https://issues.dlang.org/show_bug.cgi?id=14704
see also:
http://forum.dlang.org/post/trrxoacvpyyqrdfqx...@forum.dlang.org
OK. I'm putting in my vote for this, and maybe even write up a
pull request.
The value from this comes when using "component-oriented"
programming, as touted by AA and WB:
http://www.drdobbs.com/architecture-and-design/component-programming-in-d/240008321
The combination of the good practice of local selective imports,
and the use of various library functions to perform component
oriented programming, results in verbose local "import"
statements.
View the example below. The import section is nearly as dense as
the component oriented block doing the actual work. This is
smelly.
<CODE>
void main( string args[] )
{
import std.exception: enforce;
import std.array: array;
import std.algorithm.iteration: map,filter;
import std.string: removechars;
//..snip ..//
auto file = File( args[1] );
auto result =
file.byLineCopy( KeepTerminator.no, ',')
.array
.map!(a => removechars!string( a, "\"" ) )
.filter!isTriangleWord
.array
.length;
writeln("Number of triangle words: ", result);
}
</CODE>
Understandably, this isn't a huge priority, but a spot for
improvement none-the-less.
Dennis M. Ritchie's design in his comment seems to be the most
concise:
import {std.array:array; std.algorithm.iteration:map,filter};