On Tuesday, 18 July 2017 at 18:21:21 UTC, Ali Çehreli wrote:
On 07/18/2017 11:03 AM, jmh530 wrote:

> the mixin(registerMethods); could then be adjusted so that
> print(virtual!Matrix m); is mixed in automatically because we
now know
> how to construct it.

That reminds me: Would the following be possible and better?

// From
void main()
  // ...

// To
void main()
  // ...

constructMethods() could return the following string:

string constructMethods() {
  return q{
    shared static this() { updateMethods(); }

OK, I think I may have found solutions to both problems. The question is, is it too hacky?

1/ method registration

Replace this:

  import openmethods;



...that does the two above. Problem is, it needs -Jpath on the command line to work. Unless there is a workaround?

2/ updateMethods

During static construction, I could set the dispatch tables to make all the methods call a function that does updateMethods() then re-dispatches. The cost of the first method call would be huge, but if it matters the user can still call updateMethods explicitly.


Reply via email to