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

Should we avoid truncating native API? (Regex in this case) #1819

Closed
MangelMaxime opened this issue Apr 23, 2019 · 3 comments
Closed

Should we avoid truncating native API? (Regex in this case) #1819

MangelMaxime opened this issue Apr 23, 2019 · 3 comments

Comments

@MangelMaxime
Copy link
Member

Description

Hello,
the RegExpConstructor now returns a System.Text.RegularExpressions.Regex instead of a JSRegex this is a problem because sometimes you want to use the native regex instead of the one from .Net.

I personally think we should not truncate part of the JavaScript API. So the user can choose which API is preferred in his case.

For example, when writing a binding some JavaScript libraries expect a JSRegex.

Would you agree to re-introduce the native JavaScript API? :)

@alfonsogarciacaro
Copy link
Member

Fable translates F# regex as JS regex, so you should be able to send them to any JS API. In fact, I only left the RegExpConstructor because when using System.Text.RegularExpressions.Regex the global flag is always set to emulate .NET behavior, when sometimes you don't want it for performance (or need the sticky flag).

@MangelMaxime
Copy link
Member Author

MangelMaxime commented Apr 23, 2019

Ok 😄

Seems like my Safari browser is stuck on an old version of the repl and I don't know how to unblock it...

After testing in Firefox, it seems like we indeed have a a native JS regex as a result.

@alfonsogarciacaro
Copy link
Member

Yeah, Safari doesn't seem to invalidate the service worker, which looks like a bug. You can try Alt + Cmd + R.

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

No branches or pull requests

2 participants