Skip to content

no way to get a meta::info directly from string_type #303

@DaemonSnake

Description

@DaemonSnake

Hi!

Currently, it's quite easy to produce identifiers from meta::string_types with unqualid but much more difficult (or even impossible) the other way around.
For instance:

consteval {
   for (int i = 0; i < 10; ++i) {
     -> fragment namespace {
          void unqualid("func_", %{i})() {}
          namespace unqualid("ns_", %{i}) {}
     };
  }
}

Is easy enough but programmatically retrieving these functions/namespace just to print them,
much harder:

consteval {
    for (int i = 0; i < 10; ++i) {
        -> fragment namespace {
            consteval {
                // reflexpr(unqualid("func_", %{i})); //doesn't work
                // namespace s = unqualid("ns_", %{i}); //ICE if uncommented
            }
        };
    }
}

Ideally it would be nice if we could just have a meta::reflstr, when we just want the lookup but not the reification:

consteval {
   for (int i =0; i < 10; ++i) {
      meta::info fn = meta::reflstr("func_", i);
      meta::info ns = meta::reflstr("ns_", i);
      meta::compiler.print(fn);
      meta::compiler.print(ns);
  }
}

Is that possible to implement or are there some hard limitations preventing its implementation?
Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions