Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POC] Proof of concept TypeLoader, replacement for Type.GetType() #7508

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from

Conversation

Arkatufus
Copy link
Contributor

@Arkatufus Arkatufus commented Feb 18, 2025

TypeLoader String to Type Map

  • TypeLoader should support the current configuration type naming pattern and be able to match:
    • Fully qualified assembly type name
    • Partial "full assembly name" with "{namespace}.{typeName}, {assemblyName}" string format
    • Partial "full assembly name" with "{typeName}, {assemblyName}" string format
    • Type full name with "{namespace}.{typeName}" format
    • Type name only
    • Arbitrary string to type mapping
  • TypeLoader should be able to throw an exception when lookup failed, just like Type.GetType() does.
  • TypeLoader should return null when lookup failed, just like Type.GetType() does.

Note that we discard version, culture, and public key metadata. Should we also match these?

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer something simpler and less generic for this purpose.

internal sealed class KnownTypes {
   // ideally, should not need to be concurrent - should all happen at ActorSystem launch
   private readonly Dictionary<string, Func<Mailbox>> typesOfMailboxes;
   public Func<... args for mailbox, Mailbox> GetMailbox (string typeName) {
         
   }
}

We're not going to support type lookup for arbitrary stuff - so no need for a generic abstraction here. It's my preference to make this all as strongly typed, fewest-moving-parts as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants