Hacker News new | past | comments | ask | show | jobs | submit login

I see that the JavaScript package is at [1] and it's implemented by compiling the Rust code to WASM. That should eventually make it pretty easy to run it.

It has a typescript definition file, but it looks like it's autogenerated and a bit clunky. You get back a CompileResult and have to call free() explicitly, it seems? That doesn't seem very idiomatic for JavaScript.

Also, the links to the documentation and examples in the README are broken.

[1] https://www.npmjs.com/package/prql-js




That's true - the package is auto-generated using [wasmpak](https://github.com/rustwasm/wasm-pack), that's why TypeScript definitions are clunky. I did the initial prql-js release and I'm actually not sure about the free() issue you are talking about.

We are currently working on compiling it for both Node.js and the browser target, and would be happy to see some advice if you are familiar with WASM!


I didn't actually try it out and I'm not all that familiar with WASM. Here is the typescript I see (stripped of boilerplate comments):

export function compile(s: string): CompileResult;

export class CompileResult { free(): void;

  readonly error: CompileError | undefined;

  readonly sql: string | undefined;
}

What is the purpose of the free() method?


Thanks a lot — issue added: https://github.com/prql/prql/issues/708




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: