Scalar + array operations

Stefan Frijters via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed May 21 11:03:17 PDT 2014


On Wednesday, 21 May 2014 at 17:07:27 UTC, Francesco Cattoglio 
wrote:
> On Wednesday, 21 May 2014 at 13:52:47 UTC, John Colvin wrote:
>> On Wednesday, 21 May 2014 at 11:45:57 UTC, Stefan Frijters 
>> wrote:
>>> I would have expected the last case to work as well, but I get
>>>
>>> testarr.d(20): Error: incompatible types for ((dfoo) * 
>>> (ibar[])): 'double' and 'int[]'
>>>
>>> Is this by design? It was very surprising to me, especially 
>>> since all other combinations do seem to work.
>>>
>>> Kind regards,
>>>
>>> Stefan Frijters
>>
>> Please file a bug, there's no reason for that not to work, it 
>> just needs to be implemented properly.
>
> To me, it just feels reasonable that it is not allowed. What 
> should be the correct type of the result? int[]? I thought 
> double to int conversion was not allowed unless you explicitly 
> asked for it.

No, I expected and desired an array of doubles, implicitly 
converting the array of ints to doubles.


More information about the Digitalmars-d-learn mailing list