On Friday, 15 March 2024 at 20:36:56 UTC, rkompass wrote:

I'm quite new to D yet. But I have some acquaintance with Python. Therefore, together with templates the discovery of the Variant type was inspiring me to the following: I wanted to explore if it's possible to do sort of type-agnostic programming with D. This could perhaps enable a simpler translation of Python code to D.

Trying with a `Variant[Variant] dct;` dictionary I observed that even simple assignment of key:value pairs was not possible as the different types are not automatically cast to a Variant.

You're not the first one. There's no technical reason for the restriction. It's simply a matter of being opposed by those who make these decisions on the basis that it's the wrong way to program or something like that. Here is a recent thread: https://forum.dlang.org/post/ikwphfwevgnsxmdfq...@forum.dlang.org

Reply via email to