What is the reasoning behind the lack of conversions when passing parameters

Carl Sturtivant sturtivant at gmail.com
Thu Feb 15 18:24:15 UTC 2024


On Wednesday, 14 February 2024 at 19:30:36 UTC, Walter Bright 
wrote:
> On 2/14/2024 9:46 AM, Carl Sturtivant wrote:
>> On Wednesday, 14 February 2024 at 04:41:45 UTC, Walter Bright 
>> wrote:
>>> On 2/13/2024 4:38 PM, Carl Sturtivant wrote:
>>>> This would be so that any literal or value of any type can 
>>>> be passed to a parameter of type Any, enabling naive 
>>>> scripting and experimenting in any context without an import.
>>>
>>> Isn't that what a sumtype is?
>>
>> Informally Any would be the sum of all types. Would your 
>> proposal encompass this?
>
> No, each type would have to be enumerated in the declaration.

OK, I was asking if Any could explicitly be added to the language 
for the reasons stated above, as it cannot be implemented in D. 
How is your remark about Any being a sumtype connected to 
providing Any in D?


More information about the Digitalmars-d mailing list