-
Notifications
You must be signed in to change notification settings - Fork 8
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
A better AssemblyName / TypeName #5
Comments
I too noticed AssemblyName and TypeName are together a lot. However, I want to keep the external API as simple as possible. I.e. calling a function with two strings is a lot simpler (and nicer to read), than calling some constructor to build some "NameType". I'd rather have some redundancy internally in the library, if that means the external API is nicer. Having said that, maybe all the "niceties" can be done in the build functions. If you have a suggestion on how to implement this, I'd love to read it. Also, I will read section 7.1, I haven't yet. |
I do have a best-of-both-worlds proposal. I'll do a draft when I get back to a full-sized keyboard. |
OK, the reason why I don't want to adopt the strings-only approach is because the backend I am writing wants to be able to combine a few types into a bigger one, and it's better to centralize the logic for how that affects the serialized name construction. I propose:
Now all the Build functions would be changed, just to pick an example:
becomes
I would argue that this is actually better from a simplicity-of-the-easy-cases-and-for-new-users perspective, because now you can write:
or
or however else you want to say it, and it reads just like the resulting IL will (except with quotes around it). Good? Bad? How can it be even better? [Premature optimization jungle:] The performance penalty that you will pay for getting your pre-stringified type names washed through the parser and the pretty printer is the price of an understandable error message when something is screwy instead of probably-more-confusing one from ilasm later. If that performance is the ultimate concern you could:
|
Copied from issue 2:
The text was updated successfully, but these errors were encountered: