DIP 88: Simple form of named parameters

Michel Fortin via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 24 05:24:23 PST 2016


On 2016-01-23 14:19:03 +0000, Jacob Carlborg <doob at me.com> said:

> This is mostly to prevent ugly hacks like Flag [1].
> 
> http://wiki.dlang.org/DIP88
> 
> [1] https://dlang.org/phobos/std_typecons.html#.Flag

On further thought, how do you make templates with specialization take 
named arguments?

	template TFoo(T)        { ... } // #1
	template TFoo(T : T[])  { ... } // #2
	template TFoo(T : char) { ... } // #3

My guess would be this:

	template TFoo(T:)        { ... } // #1
	template TFoo(T: : T[])  { ... } // #2
	template TFoo(T: : char) { ... } // #3

... but it makes the declaration a bit strange.

-- 
Michel Fortin
http://michelf.ca



More information about the Digitalmars-d mailing list