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

Make LexicalScope public #71

Closed
koliyo opened this issue Jun 23, 2021 · 3 comments
Closed

Make LexicalScope public #71

koliyo opened this issue Jun 23, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request need info Clarification from reporter expected

Comments

@koliyo
Copy link

koliyo commented Jun 23, 2021

I understand wanting to keep LexicalScope an internal implementation detail.

But allowing adding statements manually instead of using CodeGenerator would be really helpful when there is a lot of existing code using standard System.Linq.Expressions patterns.

If I could manually call LexicalScope.Current.AddStatement, it would save me a lot of code rewriting. And make gradual migrations to the dotNext LinqEx handling.

Preferably I would like to be able to do the following:

  1. Create a LexicalScope/AsyncLambdaExpression using manually specified ParameterExpression[], instead of just System.Type[]
  2. Be able to manually construct the LexicalScope, specifically using ILexicalScope.AddStatement
@sakno sakno self-assigned this Jun 23, 2021
@sakno sakno added the question Further information is requested label Jun 23, 2021
@sakno
Copy link
Collaborator

sakno commented Jun 23, 2021

Hi @koliyo ,

  1. Yes, I can add support of ParameterExpression[] for AsyncLambdaExpression and LambdaExpression
  2. LexicalScope is really internal thing. It is tightly coupled with thread-local storage to follow the natural flow of instructions. Leakage of this abstraction can cause unpredictable behavior. For instance, you will save the reference to the scope and share it with another thread or reuse after construction. But I can add public static CodeGenerator.AddStatement method for the convenience.

@sakno
Copy link
Collaborator

sakno commented Jun 23, 2021

Also, could you please provide minimal example in C# for what you expected from new API?

@sakno sakno added enhancement New feature or request need info Clarification from reporter expected and removed question Further information is requested labels Jun 23, 2021
@sakno
Copy link
Collaborator

sakno commented Jul 28, 2021

I'm closing issue because Statement static method has been added to release 3.3.0 and no additional feedback was received. @koliyo feel free to reopen this issue if you have a concrete suggestion about API design.

@sakno sakno closed this as completed Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request need info Clarification from reporter expected
Projects
None yet
Development

No branches or pull requests

2 participants