On Thursday, 7 February 2013 at 19:57:50 UTC, Walter Bright wrote:
On 2/7/2013 3:16 AM, deadalnix wrote:
The 'funny' things is that C#'s would cause syntax problem
issue with address
of,
where D does.
I don't understand this sentence.
In C#, foo.bar won't execute bar's method of foo. It will get
what is called in
D a delegate. foo.bar() execute that delegate.
It remove the need for &foo.bar altogether, so with that
mechanism in D, no
problem with & operator.
Scala does even one step further by executing the method, or
not, depending on
what is expected, proving that optional () are compatible with.
Back to D, we have void function() foo; foo is declared as a
function here.
No, that declares foo as a "pointer to function".
That isn't what I read. It is clearly written void function()
foo; And if in int a; a is an int and in int* b, b is a pointer
on int, foo must be a function. The fact that this very entity
type is called function pointer is C is irrelevant.
The distinction between the 2 is a problem in the first place, as
it create new entities with different behavior, for a benefice
that is unclear to me.
Now you can pass several object to templates alias parameters,
that will behave
differently in slightly different subtle ways. For no real
good reason.
They won't behave any differently than they would outside of
being passed as aliases. I don't see a special problem added
with alias parameters.
Because the same syntax have different meanings, so suddenly, you
have to special case everything. That is never done in practice,
not even in phobos.
If A is the instruction pack entity type mentionned above,
you'll find pretty
hard to find a !A if we exclude C and C++ (well and D, but it
is kind of
excluded if look for references). I don't pretend none exists,
but it seems
pretty hard to find one.
There are few languages in the systems programming category
(languages that give one full access to pointers), so excluding
C and C++ seems rather draconian.
I don't see why this should be limited to system languages. This
is about function and most languages have functions (and most
modern languages have first class functions).
Additionally, as show with scala or C#, the semantic of theses
language often do not conflict with pointer access.
He does so by adding special cases. That is the problem with
special cases, they
multiply themselves faster than rabbits.
Taking the address of a ref was already problematic.
Yes indeed. I never argued against that.