Giter VIP home page Giter VIP logo

Comments (3)

slevithan avatar slevithan commented on June 15, 2024

The MSDN documentation is misleading. regexp.compile doesn't make a regex faster. I believe there's a compile method for regexes that really does make things faster in .NET land, but with JavaScript, it's just a way to mutate an existing regex instance (while leaving other properties on the regex intact). It's possible to imagine weird and creative uses for this, but I've certainly never wanted to use it in practice. The very existence of this feature can make it harder to reason about code. It's generally just a bad feature, and was deprecated for a reason. That said, of course it might be required for web compatibility. If I recall correctly, back in the early Safari v3 days, I mentioned lack of support for the compile method on an unrelated Safari bug, at which point the devs involved went ahead and added the method in case it was needed for web compatibility. AFAIK, there was no strong evidence for that at the time, at least.

from javascript.

mathiasbynens avatar mathiasbynens commented on June 15, 2024

The latest ES6 draft specs RegExp.prototype.compile: http://esdiscuss.org/topic/anewesspecdrafthasbeenposted http://wiki.ecmascript.org/doku.php?id=harmony:specification_drafts

TODO: remove it from the JS spec after review.

from javascript.

mathiasbynens avatar mathiasbynens commented on June 15, 2024

https://tc39.github.io/ecma262/#sec-regexp.prototype.compile

from javascript.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.