Fable: 我们应该避免截断原生 API 吗? (在这种情况下为正则表达式)

创建于 2019-04-23  ·  3评论  ·  资料来源: fable-compiler/Fable

描述

你好,
RegExpConstructor现在返回System.Text.RegularExpressions.Regex而不是JSRegex这是一个问题,因为有时您想使用本机正则表达式而不是 .Net 中的正则表达式。

我个人认为我们不应该截断 JavaScript API 的一部分。 因此,用户可以选择在他的情况下首选哪个 API。

例如,在编写绑定时,一些 JavaScript 库需要 JSRegex。

你同意重新引入原生 JavaScript API 吗? :)

所有3条评论

Fable 将 F# 正则表达式转换为 JS 正则表达式,因此您应该能够将它们发送到任何 JS API。 事实上,我只留下了RegExpConstructor ,因为当使用System.Text.RegularExpressions.Regex时,全局标志总是设置为模拟 .NET 行为,而有时你不希望它用于性能(或需要粘性标志)。

好的😄

好像我的 Safari 浏览器卡在了旧版本的 repl 上,我不知道如何解锁它......

在 Firefox 中进行测试后,似乎我们确实有一个原生的 JS 正则表达式。

是的,Safari 似乎并没有使服务工作者失效,这看起来像是一个错误。 你可以试试 Alt + Cmd + R。

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

alfonsogarciacaro picture alfonsogarciacaro  ·  3评论

nozzlegear picture nozzlegear  ·  3评论

et1975 picture et1975  ·  3评论

alfonsogarciacaro picture alfonsogarciacaro  ·  3评论

alfonsogarciacaro picture alfonsogarciacaro  ·  3评论