GithubHelp home page GithubHelp logo

Comments (4)

benharsh avatar benharsh commented on June 26, 2024 2

This initializer appears to be the regex type's default initializer, so it's not quite as weird or edge-case-y as its usage by chpl__deserialize might suggest. I think documenting this initializer and putting some kind of .. warning:: could help users who still accidentally write code like the above example.

An even better next step (separate from this issue) would be to add some better checking for this case within regex's implementation and issue some better errors.

from chapel.

mppf avatar mppf commented on June 26, 2024 2

I would imagine this initializer comes up primarily with things like var x: regex; and that it's significantly more common in that form than new regex(string) etc. Generally speaking, I think it's reasonable for regex to be default-initializable; and that it should not core dump when you go to write one of those. Of course, the alternative idea is to prevent it from being default-initializable, but IMO that is not called for here.

from chapel.

e-kayrakli avatar e-kayrakli commented on June 26, 2024 1

I'm ok with no-doc'ing it. chpl__deserialize's use is not a good precedent. What it does with the quasi-initialized regex is also not user-facing.

The only use case I can think of is to create a dummy empty regex for a sentinel value or a dummy return, but the way to do it should be new regex("").

from chapel.

jabraham17 avatar jabraham17 commented on June 26, 2024 1

It seems like the general consensus is that this should stay in the public interface and be documented, and that we should fix the bug.

The bug comes from a nullptr dereference in the re2 runtime shim, where regex->regex is a nullptr. writeln triggers 1 of the possible errors. There are a few other ways to hit this. I will patch these and open a PR with the bug fix and the documentation (with a warning about possible erroneous behavior when used incorrectly)

from chapel.

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.