Comments (10)
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.
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.
o.O
from grain.
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.
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.
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.
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:
I would expect the result of the multiplication to be seen.
Thanks a lot for your help
from grain.
I think this section in specific, and the whole --help generally, really hide the
grain file
option.
I would recommend a more explicit documentation of it.
from grain.
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.
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)
- Grainfmt: Experiment with print_comment_range refactor
- Grainfmt: Better API for concat_map
- Grainfmt: Support `formatter-ignore` in more places
- Grainfmt: Comment lost when preceding a number HOT 1
- Formatter: Pun aliases when possible
- Formatter: Missing trailing comma on inline record fields
- Stdlib: Add `String.map` and `String.flatMap` functions
- Formatter: disallow double-breaks on attributes
- Docs: Add variant docs to Json data structure
- Cleanup: Use graindoc `Markdown` lib in lsp
- Lsp: Provide context for `use XXX.*`
- stdlib: Add `input` function HOT 2
- language: look into overloading the `array[x]` syntax to support multiple number types.
- Rework: `toString` to use a buffer HOT 1
- Decrease initial memory pages to 1 HOT 3
- Implement LEB128 stdlib HOT 1
- stdlib: Add a `TOML` library
- stdlib/runtime: Implement a basic parsing library
- Improve compilation of large list/array literals
- Redundant Operations in stdlib Set.intersect HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grain.