refInt = ref int: how to achieve this? or is this a bug?
mw
mingwu at gmail.com
Wed Jun 17 23:58:37 UTC 2020
On Wednesday, 17 June 2020 at 23:48:52 UTC, Stanislav Blinov
wrote:
>> f( T) /*more static if here*/ { /*potential dup code here*/
>> }
>> f(ref T) /*more static if here*/ { /*potential dup code here*/
>> }
>>
>> I would call for improvement.
>
> Again, looking at your code, this all comes out of your trying
> to conflate references and pass by reference. References (i.e.
> classes) and values (i.e. primitive types and structs) are
> semantically different, so should be treated differently.
It has to be done: because the C lib only accept void* as value.
So on the D side, need to pass to C:
-- primitive types, class (essentially pointers) by value
-- struct, union, array|string, by reference
The discussion here is how to make this passing code simple to
write.
More information about the Digitalmars-d
mailing list