A better way to deal with overloading?

Profile Anaysis via Digitalmars-d digitalmars-d at puremagic.com
Fri Jan 27 17:55:10 PST 2017


On Friday, 27 January 2017 at 11:16:09 UTC, Patrick Schluter 
wrote:
> On Thursday, 26 January 2017 at 00:02:03 UTC, Profile Anaysis 
> wrote:
>> [...]
>
> It's funny (or sad) that C has compound types since C99 and 
> that they are good.
> Your  foo(|a,b,|c1,c2,3||,|e|,|f,g,c|) writes as
>
> foo((T1){a,b,{c1,c2,c3}}, (T2){e}, (T3){f,g,c});
>
> of course, the lack of object orientation and other things 
> makes it easier in C.


Yeah, this seems similar to what I am saying. The only difference 
is that the cast is not required because the types can be deduced 
for functions. I don't see anything in the 
spec(https://gcc.gnu.org/onlinedocs/gcc-4.2.2/gcc/Compound-Literals.html) showing function calls using "compound literals though", which was my suggestion.





More information about the Digitalmars-d mailing list