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

is there any plan to support attribute and more complex reflection features? #3987

Open
gmono opened this issue Dec 29, 2024 · 1 comment
Open

Comments

@gmono
Copy link

gmono commented Dec 29, 2024

as title
also memory span and ArraySegment
moreover ArraySegment can be implemented directly in F#, and Span can also be simulated directly using TypedArray+offset.
and it seems that there are many ways to support attribute such as setting a property named "__metadata" in class (store together with datafields and configured to be "not enumerable" or you can just use "Symbol" or some other equivalents) and "__attrs" which is used to save the references to the classentity(compile result) of the attribute and the reflection operations can be used to find these infomation to achieves the more prefer reflection supports

is there any plan to implelement those feature above?

the main problem is that I've used it in a company project

@MangelMaxime
Copy link
Member

Hello,

Could you please specify which target are you referring too? My supposition is JavaScript but I could be wrong.

I am not familiar with the API mentioned above so I don't how in which scenario they are useful or not. Fable doesn't aims to support all the BCL API but if an API can be implemented and "make sense" in general we are open to adding support for it.

  • Adding ArraySegment should be possible yes, to do that we probably need to create our own type because I don't think JavaScript has an equivalent or we can simulate using F# to copy/paste the code between targets (if the output is performant enough as I suppose it is used for performance)
  • Span: at the time of introduction of Span, I think Alfonso decided to not support them because their was not equivalent in JavaScript. Does it make sense to support Span which are using for performance / memory control when in JavaScript it will not have exactly the same behaviour?
  • Improving reflection support: perhaps it depends on the scenario you would like to support. Fable reflection API is limited, decision for that was to not increase the bundle size too much. For example, right now we support reflection for DUs, Field, Types level (not the members, etc.). So perhaps, we could add the Attributes information for the cases we currently support but for the members this means we need to evaluate if we can support them or not. Right the Reflection API of Fable can be removed by the bundlers if not used and we want to keep that I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants