Forcing inlining of delegates and lazy

ABrightLight example at example.com
Mon Aug 31 19:37:27 UTC 2026


On Monday, 31 August 2026 at 18:18:59 UTC, monkyyy wrote:
> On Monday, 31 August 2026 at 17:36:55 UTC, ABrightLight wrote:
>> Hello. I am trying to figure out some way to get delegates or 
>> lazy parameters to get inlined into the function they are 
>> called with.
>> ```lisp
>> ```
>> These sorts of macros greatly aid in readability and 
>> maintainability.
>>
>> The drawback to the lazy/delegate approach so far is the extra 
>> indirection of the function call.
>
> Are you not making a type error? A delegate is a runtime 
> function pointer and context, macros and inlining are ct
>
> depending on use I think whatever your trying to do would 
> naturally work if it was static functions gathered up at 
> compile time

It shouldn't be a type error. My thought is that since the lazy 
expression (lowers to a delegate) is actually known to be eager 
here, and it's not pointing to some delegate made elsewhere (it's 
essentially a literal), it should be entirely possible to just 
inline into the equivalent form in the first sample that does not 
rely on lazy.


More information about the Digitalmars-d mailing list