ModuleInfo, Object.localClasses(), and Object.find() - any users?

H. S. Teoh hsteoh at qfbox.info
Sat Dec 10 00:28:44 UTC 2022


On Sat, Dec 10, 2022 at 01:19:11PM +1300, rikki cattermole via Digitalmars-d wrote:
> On 10/12/2022 11:35 AM, H. S. Teoh wrote:
> > But maybe it's possible to make this pay-as-you-go?  I.e., if nobody
> > actually calls Object.localClasses or Object.find, then it won't be
> > included.  Only if somebody actually references it, it will be
> > included.  Sorta like a template.  But I've no idea how feasible it
> > is to implement such a thing.
> 
> Its a little too indirect I think.
> 
> I just can't see anything pulling in the symbol that have to be
> generated for the localClasses array and the linker will just strip it
> out.

One idea is to turn the array into a template function that returns an
array, the instantiation of which somehow triggers the generation of the
extra info.

But the question is, is this feature even being used at all in the first
place... if not, pulling stunts of this sort is just wasted effort.


T

-- 
Making non-nullable pointers is just plugging one hole in a cheese grater. -- Walter Bright


More information about the Digitalmars-d mailing list