Functional programming in D and some reflexion on the () optionality.

deadalnix deadalnix at gmail.com
Tue Aug 7 07:36:38 PDT 2012


Le 07/08/2012 14:15, Mafi a écrit :
> On Monday, 6 August 2012 at 19:45:17 UTC, deadalnix wrote:
>> Le 06/08/2012 21:07, Mafi a écrit :
>>>> No dereferencing is done in the compiled code anyway. BTW, an «
>>>> address of » operation is done on the type mentioned above.
>>>>
>>>
>>> I don't get what you are saying here. For me there's an inherent
>>> difference between a fuction and a function pointer. You shouldn't try
>>> to conflate them in a system language in my opinion.
>>>
>>
>> On any hardware, a function call will boil down to set up stuff on the
>> stack and branching, jumping, calling or whatever on the ADDRESS of
>> the function's code.
>>
>> In other term, what is generated always involve the function's
>> instruction address. If you dereference that address, you get
>> instructions, but that hardly something useful to have at higher
>> levels because you can"t do anything with it anyway.
>>
>
> It's the same with an int on the stack, isn't it (literally on the
> stack; not optimized into a register). To access it, one has to
> dereference its address but you wouldn't like conflating int and int*.
> The difference is between the address being a constant (maybe relative
> to the stack) and being totally unknown. In my opinion this is a big
> difference, also for functions.
>
> ...

This is basically what is done for objects, and with great benefice.


More information about the Digitalmars-d mailing list