GithubHelp home page GithubHelp logo

Comments (10)

phated avatar phated commented on June 1, 2024

A grain file is not a wasm file. This is a WebAssembly error because you passed a non-wasm module to the WebAssembly constructor.

from grain.

phated avatar phated commented on June 1, 2024

Re-opening because I think we can split the wasm compilation into a separate try/catch and then say something like "Invalid WebAssembly module. Make sure you are running a .wasm file"

from grain.

ShalokShalom avatar ShalokShalom commented on June 1, 2024

o.O

from grain.

ShalokShalom avatar ShalokShalom commented on June 1, 2024

Let me get this straight. You are providing me with exactly one way to run your code, and that is via wasm. The pure compilation from grain, as said, yielded no error.

I expect this to work, just as I did. As in any other language. This sounds like the guts of the languages are exposed to the user, and that one is currently expected to understand the inner workings, just to get the info on a super simple function, and why it failed.

Like...

from grain.

ospencer avatar ospencer commented on June 1, 2024

grain run is a command that runs wasm files, not Grain programs. The command that both compiles and then runs the resulting wasm from a Grain program is just the top level grain command, grain test.gr.

It's a little different than other languages because interpreted languages like JavaScript (running in node.js) don't have a compile stepโ€”you just run the JavaScript. Compiled languages typically produce an executable that you run yourself. Since we compile to WebAssembly, which can't be run natively on your machine, we also provide a utility to run wasm files.

from grain.

phated avatar phated commented on June 1, 2024

The grain run command clearly states it takes a wasm file:

$ grain run --help
Usage: grain run [options] <file>

run a wasm file via grain's WASI runner

While the grain command says it compiles and runs a program:

$ grain --help
Usage: grain [options] <file>

Compile and run Grain programs. ๐ŸŒพ

These are not the same and grain run can run any wasm file, not just wasm output by grain.

from grain.

ShalokShalom avatar ShalokShalom commented on June 1, 2024

I would expect grain run file to run a grain file.

Both due to the name of it, and because its like this in other languages.
But just grain file compiles, seemingly successful and gives me no output:

Screenshot_20230915_003654

I would expect the result of the multiplication to be seen.

Thanks a lot for your help

from grain.

ShalokShalom avatar ShalokShalom commented on June 1, 2024

I think this section in specific, and the whole --help generally, really hide the
grain file option.

Screenshot_20230915_003844

I would recommend a more explicit documentation of it.

from grain.

ShalokShalom avatar ShalokShalom commented on June 1, 2024

So now you are hi jacking my issue? I came here to find help, not to become belittled for confusing documentation and left with no answer.

from grain.

phated avatar phated commented on June 1, 2024

The issue topic was that running a non-wasm file through the wasm runner provided a bad error message. We have a way forward to improve the error message. Ranting about tangential things can be done in Discussions.

I've locked the issue so we can properly track the problem specified.

from grain.

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.