small idea

eles eles at eles.com
Wed Jan 9 08:23:04 PST 2013


On Wednesday, 9 January 2013 at 15:10:47 UTC, bearophile wrote:
> eles:
>
>> void make_a_equal_to_b(??a,!!b); //I give you "b", give me "a"
>
> A saner syntax is just to use the same in/out/inout keywords at 
> the call point, This is essentially what C# does (with one 
> exception for COM):
>
> make_a_equal_to_b(ref a, in b)
>
> This feature was discussed several times in past for D. The 
> advantage is more readability for the code and less surprises. 
> The disadvantages are more typing, some code breakage of D2 
> code (because even if at the beginning it's a warning, and 
> later a deprecation, you will eventually need to enforce it 
> with an error).

Assuming that annotation-breaking is on a separate level of 
errorness than errors and regular warnings will avoid that 
problem. It will remain at the level "annotation", no need to 
migrate to "warning" or "error". Code will not break as long as 
typying "inout" &co. will be optional. If the programmer feels it 
is better, he puts it there.


More information about the Digitalmars-d mailing list