February 27, 2013
On Wednesday, 27 February 2013 at 17:30:16 UTC, Andrej Mitrovic wrote:
> So now you have to carefully inspect every function call because you
> don't know whether you're passing a pointer to a function or you're
> invoking the function and passing the return type.

One more reason to hate optional parens, hah!
February 28, 2013
On Wednesday, 27 February 2013 at 17:30:16 UTC, Andrej Mitrovic wrote:
> On 2/27/13, deadalnix <deadalnix@gmail.com> wrote:
>> That is fallacy.
>
> void func(T...)(T args) { }
>
> int foo() { return 1; }
> float bar() { return 2.0; }
>
> void main()
> {
>     func(foo, bar);  // ???
> }
>
> What will this do? If address-of on functions is banned then this must
> pass functions by default, and not their return types. Which is a
> complete change to what it does now.
>

Yes it is.

> So now you have to carefully inspect every function call because you
> don't know whether you're passing a pointer to a function or you're
> invoking the function and passing the return type.
>

This ambiguity is what the DIP intend to solve. Here foo can refers to different entity types depending on the context. When you do &foo, you refers to function in the C meaning of the term, when you do foo, you refers to function call.

> How on earth does this simplify anything and justify code breakage?

It remove an entity type from the language, so remove an entire line and column in the feature matrix, so it simplify its definition, its implementation and get rid of a whole class of corner cases. It reduces the number of cases you have to account for in generic code as well. It remove ambiguities that currently exists on the usage of unary & operator. It makes D more friendly for functional style of code.
1 2 3 4 5 6
Next ›   Last »