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

Walter Bright newshound2 at digitalmars.com
Wed Feb 7 21:42:17 UTC 2024


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.



More information about the Digitalmars-d mailing list