On 1/31/11, bearophile <bearophileh...@lycos.com> wrote: > Walter has tried to unify the two, using a syntax like: > void foo(int x, static int y, int z) {} > That's equivalent to: > void foo(int y)(int x, int z) {} > > But the legend says he has found unspecified implementation difficulties, so > the idea was abandoned. One purpose of D design is to avoid excessive > compiler complexity. >
Well I do think there should be a difference between compile time and runtime arguments, so I'd keep the current syntax rather than mix the two. Perhaps D3 could have a form of static expressions: import std.typecons, std.functional, std.array; auto optArg(alias pred, alias fn, Range)(Range r) { // same as before } void main() { alias static optArg!"a < b" minArg; alias static minArg!"a" foo; assert(foo([5, 2, 1, 3]) == tuple(1, 1)); } and then we could have: import std.stdio, std.typetuple, std.algorithm, std.traits, std.range; void main() { int[] arr1 = [ 1, 2, 3, 4 ]; int[] arr2 = [ 5, 6 ]; auto squares = map!("a * a")(chain(arr1, arr2)); //~ alias staticMap!(Unqual, int, const int, immutable int) T; alias static map!(Unqual, int, const int, immutable int) T; } I'm not sure how that would work, I'm just throwing ideas in the air. :)