[-] Vorpal@programming.dev 2 points 5 months ago

The standard library does have some specialisation internally for certain iterators and collection combinations. Not sure if it will optimise that one specifically, but Vec::into_iter().collect::<Vec>() is optimised (it may look silly, but it comes up with functions returning impl Iterator

[-] Vorpal@programming.dev 0 points 5 months ago

Please, send an email to lwn@lwn.net to report this issue to them, they usually fix things quickly.

[-] Vorpal@programming.dev 1 points 5 months ago

Yes, rust is that much of a pain in this case, since you can only safely pass plain C compatible types across the plugin boundary.

One reason is that rust doesn't have stable layouts of structs and enums, the compiler is free to optimise the to avoid padding by reordering, decide which parts to use as niches for Options etc. And yes, that changes every now and then as the devs come up with new optimisations. I think it changes most recently last summer.

[-] Vorpal@programming.dev 1 points 5 months ago* (last edited 5 months ago)

So there is a couple of options for plugins in Rust (and I haven't tried any of them, yet):

  • Wasm, supposedly https://extism.org/ makes this less painful.
  • libloading + C ABI
  • One of the two stable ABI crates (stabby or abi_stable) + libloading
  • If you want to build them into your code base but not have to update a central list there is linkme and inventory.
  • An embedded scripting language might also be a (very different) option. Something like mlua, rhai or rune.

I don't know if any of these suit your needs, but at least you now have some things to investigate further.

[-] Vorpal@programming.dev 1 points 6 months ago

It very much is (as I even acknowledge at the end of the github README). 😀

[-] Vorpal@programming.dev 1 points 7 months ago

The example FileDescriptorPollContext doesn't really work. What if my runtime uses io-uring instead of polling? Those need very different interfaces to be sound. How do you abstract over that.

[-] Vorpal@programming.dev 1 points 8 months ago

I would indeed consider Go a bigger language, because I do indeed think in terms of the size of the runtime.

But your way of defining it also makes sense. Though in those terms I have no idea if Go is smaller or not (as I don't know Go).

But Rust is still a small language by this definition, compared to for example C++ (which my day job still involves to a large extent). It is also much smaller than Python (much smaller standard library to learn). Definitely smaller than Haskell. Smaller than C I would argue (since there are leas footguns to keep in mind), though C has a smaller standard library to learn.

What other languages do I know... Erlang, hm again the standard library is pretty big, so rust is smaller or similar size I would argue. Shell script? Well arguably all the Unix commands are the standard library, so that would make shell script pretty big.

So yeah, rust is still a pretty small language compared to all other languages I know. Unsafe rust probably isn't, but I have yet to need to write any (except one line to work around AsRawFd vs AsFd mismatch between two libraries).

[-] Vorpal@programming.dev 1 points 8 months ago

can have a nontrivial (or “thick”) runtime and doesn’t need to limit itself to “zero-cost” abstractions.

Wouldn't that be a bigger rust rather than a smaller one?

Not an area I'm particularly interested in, given that I do embedded and hard realtime development. Rust is the best language for that now, I just which allocations were fallible as well. And storage/allocator API was stabilised.

[-] Vorpal@programming.dev 1 points 9 months ago

LGPL specifically does as far as I understand have some issues when used in rust. In particular the border for the copyleft is dynamic linking. That doesn't work well with rust. I would instead consider MPL where the copyleft border is on a source file level.

That said, I'm not a lawyer!

[-] Vorpal@programming.dev 1 points 1 year ago

In my manual implementation I would assume you would use a newtype, so not really relevant.

[-] Vorpal@programming.dev 1 points 1 year ago

Your idea will work with minor changes (if comments are supported in your file format). At work our tooling create entries like 123="English text" // UNTRANSLATED. Obviously not quite the same format, but it should be adaptable to any format that supports comments.

[-] Vorpal@programming.dev 1 points 1 year ago

The drama sucks, agreed. But crates.io is lightyears behind in design, search and features.

For example: Lib.rs has the first thing I want to know (when was the last release, is this still developed?) right at the top. For crates.io that is hidden near the bottom, especially on mobile.

Also: Lib.rs has search that actually works and finds relevant things, I cannot say that for crates.io.

I would love for crates.io to take (some) inspiration from lib.rs.

Finally: I share the lib.rs author's opinion on cryptocurrency, though I don't agree with his extreme measures. (If it was me I would put a note in neutral tone that crypto is problematic for the environment on the relevant categories and crates, with some links to more into, then leave it at that.) So using lib.rs despite the drama doesn't bother me that much.

view more: ‹ prev next ›

Vorpal

joined 1 year ago