Array as an argument, ambiguous behaviour.

Cooler kulkin at hotbox.ru
Thu Jan 30 02:49:41 PST 2014


>> Please stop explain me how fun3() works. I know that.
>
> This is first problem. You are being explained what is the 
> *purpose* of the fun3() but you repeatedly fail to accept it.
>
No odds.

>> One of the main idea of D is that things must work as planned, 
>> or would not compile at all.
>
> Outcryingly wrong. Study bugzilla which shows how some things 
> go wrong and read DIPs to learn that there are some issues in 
> the language for which the communitty still struggles to 
> formulate good solution.
>
Now I am trying to speak ideally. What ideal language should be, 
not the practical implementation.

>> First and second variants follow this idea. But fun3() can 
>> work not as planned on the caller side (depends on fun3() 
>> body's implementation).
>
> Many things can work not as intended. Please read forums, 
> bugzilla, etc. I bet passing array will not be the only thing 
> you find confusing.
>
Again - don't look back. Consider how we can make D better.

>> The question again - may be prohibit fun3() variant?
>
> Prohibiting code like:
> void foo(int[] arr) {}
>
> would break hell of a code and pose doubts on what happens with 
> arrays if so simple construction is prohibited. In addition, I 
> mentioned that "don't care" is probably sometimes an option. 
> Emitting warning here has some merits but it would be 
> consitently ignored (I expect).

Again - stop consider current state of D implementation. Consider 
how we can make D better. I think fun3() push programmers to make 
errors.


More information about the Digitalmars-d-learn mailing list