0no-co / wonka

🎩 A tiny but capable push & pull stream library for TypeScript and Flow
MIT License
709 stars 29 forks source link

Runtime error when used with BuckleScript 8.1.0 #85

Closed gaku-sei closed 4 years ago

gaku-sei commented 4 years ago

The new BS version seems to break, at runtime, the wonka take function:

Capture d’écran 2020-06-23 à 11 55 23

The generated code for the take function looks something like this:

if (state.taken < max) {
  if (signal) {
    state.taken = max;
    return state.talkback(/* Close */1); // Breaks here
  } else {
    return state.talkback(/* Pull */0);
  }
}

When logging, the stage.talkback propery is indeed undefined 😞

BlueHotDog commented 4 years ago

Tried looking at this, how this can even happen? isnt the whole point of Reasonml is to avoid such issues?

kitten commented 4 years ago

@gaku-sei that’s pretty interesting! I can take a look at the BS changes, but can you send the affected code snippet over please so I can get an initial idea of why the talkback isn’t set?

Austaras commented 4 years ago

@kitten the issue here is bs8 changed internal representation of variant from tag to TAG and 0 to _0 so dist need to be compiled with bs8 or it won't work