Fable: Should we avoid truncating native API? (Regex in this case)

Created on 23 Apr 2019  ·  3Comments  ·  Source: fable-compiler/Fable

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? :)

All 3 comments

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).

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SCullman picture SCullman  ·  49Comments

dbrattli picture dbrattli  ·  54Comments

alfonsogarciacaro picture alfonsogarciacaro  ·  37Comments

alfonsogarciacaro picture alfonsogarciacaro  ·  26Comments

alfonsogarciacaro picture alfonsogarciacaro  ·  35Comments