Bill Baxter wrote:
On Thu, Nov 12, 2009 at 1:42 PM, Walter Bright
<newshou...@digitalmars.com> wrote:
Currently, the type is determined by the type of the first element and the
rest are implicitly cast to it.

I propose changing it to being the type produced by applying the ?: logic
repeatedly to all the elements.


Yay!
But if you want to force a type will there be a way to do that too
without casting each item?
like
   cast(int[]) [2.0, 4.5, 6.7]

Maybe that works already?

It does. Note that if you cast an array variable (and not an array literal), it doesn't do what you expect. Instead, it reinterpret casts the array bytes. What a strange semantic difference, bug or feature?

--bb

Reply via email to