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

Factory methods renderer: Dynamic binder arguments render as binder instance #47

Open
zspitz opened this issue Sep 22, 2020 · 0 comments
Labels
zspitz.utils Depends on changes to the ZSpitz.Utils library

Comments

@zspitz
Copy link
Owner

zspitz commented Sep 22, 2020

Whenever the underlying RenderLiteral function encounters something it cannot render, it returns #<typename>, e.g. #CSharpInvokeMemberBinder.

Since these are very much a part of constructing dynamic expressions, it would provide value if instead of this:

// using System.Linq.Expressions.Expression

Dynamic(
    #CSharpInvokeMemberBinder,
    typeof(object), new[] { obj }
)

we could return something like this:

// using System.Linq.Expressions.Expression;
// using static Microsoft.CSharp.RuntimeBinder.Binder;

Dynamic(
    InvokeMember(flags, "Method", new Type[] { }, context, argInfos),
    typeof(object), new[] { obj }
)

Some thoughts:

  • I would want RenderLiteral to allow for extensible behavior. In other words, not every place we use RenderLiteral do we want to return a literal for binders.
  • Particularly since this is only the C# binders; each additional language may have other binders.
@zspitz zspitz added the zspitz.utils Depends on changes to the ZSpitz.Utils library label Sep 23, 2020
@zspitz zspitz pinned this issue Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
zspitz.utils Depends on changes to the ZSpitz.Utils library
Projects
None yet
Development

No branches or pull requests

1 participant