Coder Social home page Coder Social logo

Comments (6)

athanclark avatar athanclark commented on July 24, 2024 1

Wow I feel silly, I forgot this is actually a component of the library's FFI already x_x I'm exposing it now, sorry for the delay!

from purescript-arraybuffer.

athanclark avatar athanclark commented on July 24, 2024

@jamesdbrock could you propose an expected type signature? I'm not sure if I completely understand what you're asking for.

from purescript-arraybuffer.

jamesdbrock avatar jamesdbrock commented on July 24, 2024

I'm just proposing to add part' to the export list.

This one:

https://github.com/jacereda/purescript-arraybuffer/blob/7f90bc44247dcbeab70caef5d373833286468266/src/Data/ArrayBuffer/Typed.purs#L141

from purescript-arraybuffer.

jamesdbrock avatar jamesdbrock commented on July 24, 2024

Oh, I've been assuming that I could work with DataView and ArrayView on the same ArrayBuffer, but that's not really how this is supposed to work, is it? DataView is for network transport. ArrayView is for buffers that stay on the local machine.

I can see now that probably no-one would ever want to construct a non-aligned ArrayView.

from purescript-arraybuffer.

athanclark avatar athanclark commented on July 24, 2024

I mean, it might make sense. I personally share an ArrayBuffer between multiple DataViews and ArrayViews often. ArrayBuffer is just a reference to some mutable state, like an STRef that you can't read or write to, because it's not formatted. DataView gives you manual set and read functions, based on specific byte-wise indexes, but only with one value at a time. However, an ArrayView gives you a typed interface to an ArrayBuffer for the whole thing, acting as a typed array for a specific numeric type.

If I recall correctly, there is a way to slice into ArrayBuffers, giving you a new one to the same piece of memory, so you could offset manually like that, but I don't actually see an issue with what you're proposing. The thing is, though, this library should be a lightweight layer on top of the native interface javascript provides. I'll have to dig a little, but I'll try to get this idea fleshed out.

from purescript-arraybuffer.

jamesdbrock avatar jamesdbrock commented on July 24, 2024

Cool, thanks for maintaining this library, it's really nice.

from purescript-arraybuffer.

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.