-
Notifications
You must be signed in to change notification settings - Fork 29
IExpressionToCode with rules for FullTypeNames and fixed issue #13 #42
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
Conversation
… of ToCode expression methods. added: Rules for specifying FullTypeNames and ExplicitMethodTypeArgs. fixed: #13 Explicit type parameters for methods omitted - Instead of inferring which is complex task, I want to have setting to turn it on for my use case, and be off by default.
added: Propagation of FullTypeNames option from ExpressionToCodeImpl to ObjectToCode. changed: Made CSharpFriendlyTypeName public to be used in generation scenarios alongside with ToCode.
While I think this is a good, I have a mild preference to avoid new public API until the dust has settled; and I'm sure this isn't going to be the only rule that needs parameterization. Options:
I think I've got a preference for option 2 - that way it's usable if you're in an experimental mood, but automatic upgrades aren't broken yet. I think this would also be a good place to integrate several of @asd-and-Rizzo suggestions, who noticed inconsistencies in naming, such as the namespace |
@@ -4,8 +4,13 @@ | |||
using System.Text; | |||
|
|||
namespace ExpressionToCodeLib { | |||
static class CSharpFriendlyTypeName { | |||
public static string Get(Type type) { return GenericTypeName(type) ?? ArrayTypeName(type) ?? AliasName(type) ?? NormalName(type); } | |||
public static class CSharpFriendlyTypeName { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to be public, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I made it public because I need it in my gen scenario: dictionary of Type -≥ Expression Code. So I need Type literal. I have similar utility method in DryIoc, but yours covers more cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or, suddenly! Could I use ObjectToCode? If so, then it is fine to stay internal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use ObjectToCode.
Right, there are still a few fairly small points - can you address those? I'd love to get this feature merged. Incidentally, if you want, I can give you commit access to this repo directly. I still like the PR model, but that can make further development easier, and some small refactorings don't work well in a PR (mass renames, trivial inlines; things like the If this is all too much work; I get that too - thanks for the great contributions so far! |
Let's summarize the PR issues so far:
My plan is to look into code this week, and try to address those. |
On However, this is a minor point, not blocking for a merge. |
Oh, I see. Agree. |
added: ObjectToCode.Default and ObjectToCode.WithFullTypeNames predefined instances. YAGNI for now. changed: Inlined Rules into ExpressionToCode - too much overhead for such a simple setup. changed: Made ExpressionToCode depend on IObjectToCode implementation. Merge branch 'master' of https://github.com/EamonNerbonne/ExpressionToCode
Hi, |
Hello, may be it is easy to provide me commit rights? |
IExpressionToCode with rules for FullTypeNames and fixed issue #13
Hi Maksim, I added you to the contributors list & merged this PR - I'm definitely happy with where it's going :-). However, there are a few issues with these changes currently that make releasing this version to nuget less that ideal:
Sorry for the ridiculously long delay! |
Compared to previous PR: fixed full generic type name.