~icefox

Just foxing about.

https://wiki.alopex.li/

Trackers

~icefox/garnet

Last active 7 days ago

~icefox/oorandom

Last active a month ago

~icefox/cf_issues

Last active 1 year, 2 months ago

#3 Breaking from (labeled) blocks? 7 days ago

THOUGHTS added by ~icefox on ~icefox/garnet

#3 Breaking from (labeled) blocks? 7 days ago

Ticket created by ~icefox on ~icefox/garnet

wasm has the ability to break; from an arbitrary block, which is basically an ahead-only goto that can only leave scopes. This might be interesting/useful to expose to the language, as an option for implementing things like the maligned goto cleanup; idiom more nicely. Or, it might just be fluff that gets in the way. Ponder it.

See also: https://github.com/rust-lang/rfcs/pull/2046

#2 Faster CI through prepackaged deps. 7 days ago

THOUGHTS added by ~icefox on ~icefox/garnet

#2 Faster CI through prepackaged deps. 7 days ago

Ticket created by ~icefox on ~icefox/garnet

A .deb image for cargo-tarpaulin would be very nice for speeding up CI. It's totally possible, since other cargo plugins like cargo-lichking exist. If you decide to take this seriously, talk to the Debian rust-maintainers mailing list to get started: https://qa.debian.org/developer.php?login=pkg-rust-maintainers%40alioth-lists.debian.net

Not having to rebuild wasmtime from scratch every time would also be nice, but, that's a bit tougher since it's a lib built into the wossname. Investigate how that might work.

#1 Type inference 8 days ago

Comment by ~icefox on ~icefox/garnet

Per conversation on the Rust #lang-dev discord, this is generally an ok plan with the IR being generic'd. Also confirmed it might actually be tidier to do something like

enum TypeInfo {
    Unknown,
    Ref(...),
    Known(Type),
}

with Type being interned as well. That seems reasonable.

Also, apparently in Rust return expression return the never type !, which can be coerced to any type, which is how that stuff works. So, we'll probably also want a never type in there.

#1 Type inference 8 days ago

THOUGHTS added by ~icefox on ~icefox/garnet

#1 Type inference 11 days ago

Ticket created by ~icefox on ~icefox/garnet

Just jotting thoughts on how to do it...

The authoritative version is https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=174ca95a8b938168764846e97d5e9a2c . That's pretty much implemented in the code currently but is not actually used.

The thing is that I depart a little from that since I intern types a little more aggressively. So then I don't have a concrete type enum and a maybe inferred type enum, and it's basically down to runtime checks to make sure that after type inference succeeds the IR only has concrete types in it. This is fine, as far as it goes, but is a potential source of bugs.

However, I ALSO don't want to bother writing a whole 'nother copy of my IR struct, with all the conversion and tree-walking redundancy that would involve. ...I think the easy way out there is to make it generic on the kind of type info attached to it, so we can then just have Ir<InferredType> and Ir<ConcreteType>, and the type inference stage is just a function fn(Ir<InferredType>) -> Ir<ConcreteType>. That seems okay.

The proliferation of interned types that would produce is a little annoying, but honestly is perfectly fine. Just needs a bit of refactoring of things to keep the scope minimal, so we will sooner or later add a TypecheckContext or something to handle this.

#2 Serde support? 7 months ago

Feature added by ~icefox on ~icefox/oorandom

#1 Ability to save/load the Rand32/Rand64 state 7 months ago

Feature added by ~icefox on ~icefox/oorandom

#2 Serde support? 7 months ago

Ticket created by ~icefox on ~icefox/oorandom

Could be optional, and basically all it needs is the following code from #1:

#[derive(Serialize, Deserialize)]
pub struct Game {
     // a bunch of other fields

    #[serde(with = "Rand32Serde")]
    rng: Rand32,
}

fn rand32_get_state(r: &Rand32) -> u64 {
    r.state().0
}

fn rand32_get_inc(r: &Rand32) -> u64 {
    r.state().1
}

#[derive(Serialize, Deserialize)]
#[serde(remote = "Rand32")]
struct Rand32Serde {
    #[serde(getter = "rand32_get_state")]
    state: u64,
    #[serde(getter = "rand32_get_inc")]
    inc: u64,
}

impl From<Rand32Serde> for Rand32 {
    fn from(r: Rand32Serde) -> Rand32 {
        Rand32::from_state((r.state, r.inc))
    }
}