Skip to content

Vector.Unboxed doesn't export constructors, but Unboxed.Mutable does #49

Description

@cartazio

I think they should both be exported (or at least I dont see any good reason not to export them)

Activity

  1. Shimuuar commented on Nov 12, 2014

    @Shimuuar
    Contributor

    This stuff is wildly unsafe. One can easily construct invalid vectors and even circumvent memory safety.

    evil = V_2 1000 empty empty
    

    Now we have ostensible 1000 element vector and any valid read from vector will read past end of actual array. Same applies to mutable vector though.

    I'm not opposed to exporing constuctors but I think they should come with disclaimer: "Very unsafe. Use at your own peril". Internal module maybe?

  2. cartazio commented on Nov 13, 2014

    @cartazio
    ContributorAuthor

    we already export unsafeIndex and friends, i'm not sure if its much worse than that :)
    but yeah, putting it in a .Base or .Internal module (provided we EXPOSE that module) would be totally ok by me :)

  3. Shimuuar commented on Nov 13, 2014

    @Shimuuar
    Contributor

    With exported constructors we lose memory safety even with safe operations
    since we can create violate invariants of vectors of tuples. I however
    don't think it's major issue.
    13 Ноя 2014 г. 1:46 пользователь "Carter Tazio Schonwald" <
    [email protected]> написал:

    we already export unsafeIndex and friends, i'm not sure if its much worse
    than that :)
    but yeah, putting it in a .Base or .Internal module (provided we EXPOSE
    that module) would be totally ok by me :)

    —
    Reply to this email directly or view it on GitHub
    #49 (comment).

  4. cartazio commented on Nov 13, 2014

    @cartazio
    ContributorAuthor

    well, sure. thats why i'm totally ok with it being only exposed via a .Internal style module rather than by default. I've had to jump through some nasty painful hoops because these constructors arent properly exported though, and I dont care WHAT module they're in, just that I can get to them.

  5. added this to the 0.12 milestone on Jul 24, 2016
  6. modified the milestones: 0.12, 0.13 on Jun 11, 2020
  7. lehins commented on Jun 19, 2022

    @lehins
    Contributor

    Constructors for unboxed vectors have been exported from Data.Vector.Unboxed.Base from the beginning of time. It is an internal module as it very much should be, but it does not prevent others to shoot themselves in the foot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions