Skip to content

Storable Vector constructor is not exported #524

Description

@phadej

which fordbids doing some stuff.

The MVector constructor is exported, so I can workaround stuff for now, but it's still not great.

Activity

  1. Shimuuar commented on Feb 5, 2025

    @Shimuuar
    Contributor

    I think that exposing constructors for mutable was a mistake. But is there anything that that isn't covered by unsafe{To,From}ForeignPtr{,0}?

  2. phadej commented on Feb 5, 2025

    @phadej
    ContributorAuthor

    I think that exposing constructors for mutable was a mistake. But is there anything that that isn't covered by unsafe{To,From}ForeignPtr{,0}?

    Probably not, but for primitive vectors there aren't conversions to/from ByteArrays, so I wasn't even looking for conversions to ForeignPtr.

    I'd say if you going to hide storable MVector constructor (please don't), you should hide primitive MVector and Vector constructors; otherwise there is inconsistency in API.

  3. Shimuuar commented on Feb 5, 2025

    @Shimuuar
    Contributor

    Probably not, but for primitive vectors there aren't conversions to/from ByteArrays, so I wasn't even looking for conversions to ForeignPtr.

    That's clearly a missing API.

    What I don't like about exposed constructors: their use is unsafe and they're imported by default, If one would say import some Unsafe module to get access to constructors it wouldn't be bad. But vector originally did a poor job at separating safe and unsafe API. And any attempt to reorganize would cause too much breakage.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions