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

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Wed Feb 7 22:20:52 UTC 2024


On 08/02/2024 10:42 AM, Walter Bright wrote:
> On 2/6/2024 2:17 AM, Atila Neves wrote:
>> Sure, this would definitely help. I think the lesson learned there is 
>> that implicit conversions *by default* are a bad idea. I don't even 
>> like integer conversions, cast if you want it.
> 
> If this only impacted the person who wrote the code, that would be ok. 
> But these sorts of things have their way of insidiously infecting large 
> code bases long after the guy who wrote it has gone.
> 
> For example, macros and version algebra have caused endless suffering of 
> maintainers who have no say in what the dear departed originator did. 
> I've even known of a couple cases where the entire codebase was scrapped 
> because of it.
> 
> However, I understand that sumtypes can make good use of implicit 
> conversions. I'm working on a language proposal to enable that by making 
> sumtypes a language feature in and of itself.

Yeah, its basically just a foreach in ``callMatch``.

Then do the rewrite for real in ``functionParameters``.

Of course I'm not happy with your design, hence I made the following PoC 
PR to solve specifying names without the type :)

https://github.com/dlang/dmd/pull/16161


More information about the Digitalmars-d mailing list