Multiple return values...
H. S. Teoh
hsteoh at quickfur.ath.cx
Thu Mar 15 21:06:41 PDT 2012
On Fri, Mar 16, 2012 at 04:46:52PM +1300, James Miller wrote:
> > 2. When was the last time you needed to swap arbitrary numbers of
> > elements, and so badly and frequently, you needed a new language
> > feature for that?
> >
> >
> > Andrei
>
> I would like to point out Boscop's vector swizzling tutorial that he
> made recently as evidence that not only do you not need it that
> frequently, it is fairly easy to implement a nice syntax for it in D,
> no language changes needed.
[...]
Yeah, using opDispatch + CTFE to implement things like:
int[4] v1;
auto v2 = v1.zxyw; // or *any* permutation of wxyz
is pretty amazing. You get syntax more compact than any new language
syntax can offer, *within* the confines of the current language.
T
--
Public parking: euphemism for paid parking. -- Flora
More information about the Digitalmars-d
mailing list