More D newb questions.
Derek Parnell
derek at psych.ward
Fri May 9 15:56:33 PDT 2008
On Fri, 9 May 2008 16:01:12 +0200, Fawzi Mohamed wrote:
> What you seem to want is an implicit cast of an element to an array
> with the single element.
I agree that this will cause more problems that it will solve. However, if
we rephrase your statement slightly ...
I want to be able to cast a single element to an array. What sort of syntax
(change) would that ability need and cost?
eg.
T a, b;
T[] foo = cast(T[])a ~ cast(T[])b;
But that is far to 'wordy' to be usable. I'd like something a lot more
simple and intuitive. Maybe a new operator so that we don't upset opCat. I
hereby propose an opJoin operator. It joins two elements to form an array.
T a, b;
T[] foo = a ~~ b;
T[] bar = foo ~~ a;
T[] qwe = b ~~ foo;
Is there ANY way that this SORT OF thing could be made to work in D?
--
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
More information about the Digitalmars-d
mailing list