Coder Social home page Coder Social logo

Comments (21)

jamesdbrock avatar jamesdbrock commented on July 24, 2024 1

Oh yeah you're right purescript/purescript#4044 was introduced in purs 14.4 https://github.com/purescript/purescript/blob/master/CHANGELOG.md#v0144

So your test

from purescript-arraybuffer.

jamesdbrock avatar jamesdbrock commented on July 24, 2024 1

Hi @ozkutuk I took your advice and just deleted the polyFill() function. I also published a new v11.0.2 with the change. Thanks for making this issue! Whatever happens with purs bundle now, I hope this solves your problem.

from purescript-arraybuffer.

jamesdbrock avatar jamesdbrock commented on July 24, 2024 1

@jamesdbrock Why wasn't this published as a breaking release (e.g. v12.0.0)?

Yeah, it should be a breaking release.

from purescript-arraybuffer.

JordanMartinez avatar JordanMartinez commented on July 24, 2024

Which version of purs are you using to produce this?

from purescript-arraybuffer.

jamesdbrock avatar jamesdbrock commented on July 24, 2024

Thanks for the bug report @ozkutuk ! Do you have any suggestions about how this should be solved? Do you think we should export the polyFill function from Typed.js?

from purescript-arraybuffer.

jamesdbrock avatar jamesdbrock commented on July 24, 2024

from purescript-arraybuffer.

JordanMartinez avatar JordanMartinez commented on July 24, 2024

Reason why I ask is because of this issue: purescript/purescript#4044

from purescript-arraybuffer.

jamesdbrock avatar jamesdbrock commented on July 24, 2024

The PR which @JordanMartinez mentioned purescript/purescript#4044 was merged and included in purs 14.3. Jordan suspects that that PR might have fixed the bug which you’re seeing.

I just tried your bug reproduction steps with purs 14.3 and I got the expected output:

$ node index.js 
hello

purescript-arraybuffer wasn’t in package-sets for any purs 14.x versions prior to 14.3. What version of purs did you try this with @ozkutuk ?

from purescript-arraybuffer.

ozkutuk avatar ozkutuk commented on July 24, 2024

Weird, purs --version reports 0.14.4. Additionally, spago version == 0.20.3 and package-set is psc-0.14.4-20210826. I don't think it has any relevance but I have tried this on a Windows machine and the node version is v14.13.1.

from purescript-arraybuffer.

ozkutuk avatar ozkutuk commented on July 24, 2024

@jamesdbrock It seems that purescript/purescript#4044 didn't make it into 0.14.3 release, so I am curious how this works on 0.14.3 at all. Maybe this was a regression that is present in the 0.14.4 release? I may downgrade the purs to 0.14.3 and try again, and report the results.

from purescript-arraybuffer.

ozkutuk avatar ozkutuk commented on July 24, 2024

I have bundled both with purs 0.14.3 and 0.14.4, and indeed it bundles and runs as expected on 0.14.3. To be sure that this is caused by purescript/purescript#4044, first I have compiled purs compiler on v0.14.4 tag myself and then got a bundle from that. Later, I have reverted the commit introducing purescript/purescript#4044 and rebuilt purs again, then getting another bundle output from the resulting purs executable. Indeed, the bundle of the latter purs executable contains the function polyFill() declaration, while the former does not.

I will try to further analyze why this is the case. I am not really familiar with the purescript codebase but the Bundle.hs seems pretty self-contained, so I may find out something. Now, it seems apparent that this not related to arraybuffer, so should we re-open this issue on the purescript repo instead?

Regarding the polyfill itself, caniuse.com reports that TypedArrays are supported since IE10, and the polyfill in question is not a full-fledged TypedArray polyfill either, so I think it would be a good idea to remove it anyway.

from purescript-arraybuffer.

JordanMartinez avatar JordanMartinez commented on July 24, 2024

Thanks all for the analysis!

from purescript-arraybuffer.

jamesdbrock avatar jamesdbrock commented on July 24, 2024

Here's another way to see this same bug.

In a clone of purescript-arraybuffer:

spago -x spago-test.dhall build
purs bundle --main Test.Main --module Test.Main --output index.Test.Main.js output/**/*.js
node index.Test.Main.js

from purescript-arraybuffer.

jamesdbrock avatar jamesdbrock commented on July 24, 2024

Here's some archeology

5200641

f224bbf

#23 (comment)

from purescript-arraybuffer.

jamesdbrock avatar jamesdbrock commented on July 24, 2024

We should try to come up with a solution in this library which doesn't depend on waiting for a new purs version.

from purescript-arraybuffer.

JordanMartinez avatar JordanMartinez commented on July 24, 2024

For context, https://caniuse.com/mdn-javascript_builtins_typedarray

from purescript-arraybuffer.

JordanMartinez avatar JordanMartinez commented on July 24, 2024

And here's all methods: https://caniuse.com/?search=typedarray

from purescript-arraybuffer.

JordanMartinez avatar JordanMartinez commented on July 24, 2024

As discussed in our call, we think a good way to handle this is to force users to handle the polyfill themselves. This is similar to what affjax does in requiring users to bring their own xhr2 for the library to work.

In other words, we would

  • update the readme to clarify that one must handle the polyfill themselves if they are working with older browsers
  • delete the polyfill
  • make a new release that is breaking

from purescript-arraybuffer.

JordanMartinez avatar JordanMartinez commented on July 24, 2024

@jamesdbrock Why wasn't this published as a breaking release (e.g. v12.0.0)?

from purescript-arraybuffer.

JordanMartinez avatar JordanMartinez commented on July 24, 2024

I believe fixing this would mean doing the following:

  • reverting the change
  • republishing a new v11.0.3, which is the same as v11.0.1
  • adding the change back in, except adding the readme update part, too
  • publishing a breaking release as v12.0.0

Ideally, we could avoid this work by just checking out v11.0.1 and publishing that tag as v11.0.3, but I'm not sure if that works or not.

from purescript-arraybuffer.

jamesdbrock avatar jamesdbrock commented on July 24, 2024

I believe fixing this would mean doing the following:

  • reverting the change
  • republishing a new v11.0.3, which is the same as v11.0.1
  • adding the change back in, except adding the readme update part, too
  • publishing a breaking release as v12.0.0

Ideally, we could avoid this work by just checking out v11.0.1 and publishing that tag as v11.0.3, but I'm not sure if that works or not.

Ok I'll do that.

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.