Skip to content

Comment on Rust 1.39

Comments

Time to give this lang a try. Been wanting to build a web assembly large data table mechanism for a while, and rust appears to be an idea candidate from what i read (speed and reliability). Although it could be done using SQLite, i think could be a nice little project for learning Rust.

It's a pleasant suprise how easy targeting wasm is from Rust. Just pass on the right `--target` flag to `cargo build` if you have the toolchain installed.

And installing the right target is typically as simple as:

    rustup target add wasm32-unknown-unknown
Targeting browser APIs is a little more involved, generally requiring either:
    cargo install cargo-web
    cargo web build [...]
for stdweb, or for web-sys:
    cargo install wasm-pack
    wasm-pack build [...]

In all fairness, `GOARCH=wasm GOOS=js go build` is just as easy.

You are talking about a db engine?

P.D: I'm building a relational language (not engine, but could be part of it)

Hmm well, what I had in mind was something more of and array of arrays, where each array is a row and at each index there is a column. What I had in mind is a download of such arrays, inject them to wasm, and then access them using an external interface. Was thinking about using basic array methods as I am pretty much non experienced in Rust, and would be a good learning exercise. A relational language tho might be interesting.

Well, I'm not far from it. The original plan was base all on top a ndarray. I backed off when see how problematic was to do CRUD operations and JOINS.

Now I support: Scalars, Vectors, Tables (Vectors of Row vectors) and Indexed tables (Table alike on top of BTree). Now i'm trying to solve how incorporate iterators (https://www.reddit.com/r/rust/comments/dnhzo1/for_a_interpre...). Solving this the lang is ready to go for a MPV.

I plan to use for real for my projects, so is not just a exercise for fun.

Why target WebAssembly instead of straight native? I know that Rust is one of the "ideal" languages for WebAssembly but I thought the main point was systems level programming, not for writing code that runs in a web browser.

My primary interest in Rust is for gamedev, as an alternative to C++. The library ecosystem is a bit weak right now, although there's a lot of interest and people working to fix that, and I think the fundamental language is a great fit.

WASM lets me reuse the same codebase to host demos/previews/simpler games directly inside of a website, without needing to convince the user it's trustworthy and worth their time to download/install/grant permissions to first.

I'm sure other SPAs could also see benefits...

Why wouldn't someone do systems programming for the web browser?

Do it! Make sure you "Show HN" it later too

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.