Robert Jacques <sandf...@jhu.edu> wrote:
On Thu, 12 Nov 2009 16:42:45 -0500, 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.
Given how numeric literals currently work:
vote--
for example currently:
float[] = [1.0f, 2.5, 5.6, 0.8].dup;
under the proposal
float[] = [1.0f, 2.5f, 5.6f, 0.8f].dup;
Now, if 2.5 simply is a floating point number of unspecified precision,
leaning towards double, and we introduce a suffix to force it to be double:
auto foo = [ 2.5, 3.5 ]; // double[]
auto bar = [ 2.5f, 3.5 ]; // float[]
auto baz = [ 2.5f, 3.5d ]; // double[]
--
Simen