-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
Better strategy to split code between Expression and ExpressionInfo #66
Comments
3 Convert Expression to ExpressionInfo and handle the latterI may use the approach from sum-types to make ExpressionInfo cases a structs under the ExpressionInfo class, implementing the same interface. That's will ensure the performance of conversion from Expression to EI struct. Given that C# 7 enables This + migrating to C# 7+ may be a goal for v2.0 |
The current strategy makes the Code much more complex. wouldn't it be possible to Generate Code only for normal "Expressions" and create a second .cs file via T4 for ExpressionInfo? |
Ok may be we are at the point to split. I did not consider T4 but did consider a split. Bonus points except code simplification are:
Technically, how the template should look like?
|
I think you should have at least 2 source files. One with the complete parsing code and "using static System.Linq.Expressions.Expression;" at the top. One file with the complete ExpressionInfo type definitions. And a T4 Template wich replaces the "using static System.Linq.Expressions.Expression;" at the top. |
Putting I want and do in DryIoc use both Ecpr and ExprInfo in the same class. That means I need to prevent conflicts via either names ( There are method that accept Expr and ExprInfo as parameters. I would like to remove the midfke ground Then we may remove |
I think we may start with moving Then remove all the noize from FEC related to ExprInfo. At the end we may just copy FEC.cs to new project with ExprInfo.cs and make it work, preserving minimal changes. Better 1, or 2 line changes. Then move all tests for ExprInfo to separate project. If everything compiles - works, it will be a very good step. Then the new FECWithExprInfo package. We may even dismiss or postpone T4. |
when will you start doing this? |
Depends. I may start after merging your requests, maybe later Today or Tomorrow. |
If I should help anything, tell me. |
removed: FEC.LE `object` noise added: FEC.LE to build pack
The work is going on in |
… noize, now is 2818 vs 4173 LOC added: FEC.LE.UnitTests but did not include it in solution yet commented some benchmarks with ExprInfo until it is back
added: LIGHT_INJECT compilation constant, so you may just link FEC.cs from both projects changed: Method signatures to accept IReadOnlyList as lowest common denominator added: Missing light expression stuff to make FEC.LE compile added: Netstandard 2.0 targets added: Embedded debugging symbols
As you now already have breaking changes, maybe it's a good idea to remove obsolete API's ? |
Good idea! |
fixed: Wrong LE.LambdaExpression ReturnType changed: Simplified LE.ParameterExpression
maybe we should also modify the tests that most of them work with Expression and LightExpression? |
maybe we could also do this with conditional compilation? |
Already doing so. At the end I will link all the Unit and Issue tests (which is make sense) to the respective LE tests. You may check |
split is finished? |
The main part is finished. The tests may be added one-by-one without affecting other fixes. Therefore moving to master. |
added: internal Expression.TypeTools to help the coalesce fixed: warnings
added: LE TypeTools.FindMethod, FindProperty, FindField
@jogibear9988 , @dzmitry-lahoda , If you have possibility to help with adding the rest of the tests for LE.Expression, Just put comment here about what tests you are migrating. Check my commits above for guideline. |
I may cover |
I've converted all test where possible (GitHub issues not yet) But the ones wich include a Expression created from c# compiler are not converted! I also think we should test c# compiler generated expressions, so we should not change this tests. If we need them also for LightExpression we need to create new ones. |
I'm working on all the GH issues tests. think 20min |
problem: this line:
does not work with light expression, because Property && Field return different types! what should I do? |
I now changed the return type to MemberExpression |
I think this is fine, not sure why it was two expressions without common parent.
Yep, that's why I've already |
They do have a common parent: MemberExpression But the Return Type of the Static method of LightExpression class was to specific. It does only return a MemberExpression on the MS Code. And so the type of the variable is to specific, and C# could not compile! |
finished? |
I will uncomment benchmarks. Will check if any problems in using FEС and FEC.LE together. Will fix and close. |
Current approach is mix and max with a lot of copy-paste. Hopefully, we can devise a strategy:
1 Split the code completely, may be even move to separate file and package.
Pros:
Cons:
2 Abstract over both and have single source code for both
Pros:
Cons:
The text was updated successfully, but these errors were encountered: