On 27 August 2012 14:08, Carl Sturtivant <sturtiv...@gmail.com> wrote:
> >> extern(C) void function( ref const(Vector2) v0, ref const(Vector2) v1, >> ref const(Vector2) v2, ref const(Color) color = Color.white, BlendMode >> blendMode = BlendMode.Disabled ) fillTriangle2D; >> > > If function pointers could be called with fewer than the prototypical > number of arguments, and the remaining arguments be always initialized to > their .init defaults, you could perhaps make this sort of thing work > without the default argument values by using struct defaults. > > How would that be deficient? > ... no. Color does not .init == Color.white. You're suggesting I define a new type, obscuring the API, every time I want a non-.init default arg? Also, I think it's correct that functions shouldn't be callable without explicit parameters. Default args are carefully selected, and they are always opt-in. 'v2' in this case shouldn't be allowed to default to [ NaN, NaN ] if I omit it.