Make dur a property?

deadalnix deadalnix at gmail.com
Fri Jan 25 00:01:30 PST 2013


On Thursday, 24 January 2013 at 19:36:35 UTC, Dmitry Olshansky 
wrote:
> The same argument was brought about overloading  operators, 
> about overloading functions, etc. In other words the argument 
> is WYSIWYG, but humans inherently think in overloaded notions 
> and take obvious shortcuts
> just about everywhere.
>

That is not because it is ambiguous, where . overload behavior 
for pointer isn't.

Such behavior would be like if pointer dereferenced automagically 
and you add to put & everywhere to not dereference them. That 
would be an horrible behavior, as well as calling function 
automatically is an horrible behavior.

So we want to avoid () for convenience. I have noting against 
convenience, but here it is plain wrong :
  - We have 2 syntax to do the same thing.
  - If the return value is callable, it is unclear what is done.
  - We need something to NOT call the function, as it is called 
magically. Let's introduce &funName syntax and mess up with 
another feature.
  - It is now unclear when we take the return address or the 
address of the function.
  - It is also not clear how to pass a function as parameter (we 
have seen the case recently).
  - Depending on the callable, () and & have different behaviors, 
which is error prone, harder to learn for newcomer, harder for 
generic code, and exactly what everybody hate about C++ .

I have nothing against convenience, and like very much the 
pointer + dot behavior. I actuelly proposed something similar 
with functions : function.identifier can call the function 
without (), which is the equivalent of the pointer thing in term 
of convenience. Going further inherently mess up with other 
features of the language.


More information about the Digitalmars-d mailing list