Skip to content

Instantly share code, notes, and snippets.

View withoutboats's full-sized avatar
🦄
horsin' around

srrrse withoutboats

🦄
horsin' around
View GitHub Profile
@withoutboats
withoutboats / alt-registry-use-cases.md
Created July 11, 2018 18:32
use cases for alternative registries

This is a list of potential use cases for something like alternative registries & some analysis of how to solve these use cases.

As context, a registry contains two network service components:

  1. The index: a git repository containing metadata about the packages in the registry
  2. The crate source: an HTTP server serving the actual package data

Private registry

I want to host my own crates separately from crates.io, to serve to people with appropriate access.

We add a built in attribute for handling pin projection:

struct MyCombinator<F> {
    #[pin_accessor]
    field: F,
}

This generates a method fn field_pin(self: PinMut<'_, Self>) -> PinMut<'_, F>, and also generates these constraints:

Considerations for writing a loop over a Stream as it relates to await syntax.

JavaScript uses this syntax:

for await (elem of stream) {
   // ...
}
/*
Psuedocode from signal:
calculate_key_pair(k):
E = kB
A.y = E.y
A.s = 0
if E.s == 1:
a = -k (mod q)

This document is the result of conversations that came out of this tweet: https://twitter.com/withoutboats/status/814201265575981056

Rust's module system is too confusing

Empirically, very many new users of Rust are confused by Rust's module system. This is unfortunate: Rust's module system is not particularly innovative or powerful; it is intended only to provide fairly standard privacy and namespacing support. Too much of new users' attention is being pulled by this system as it exists today.

This document presents an hypothesis of the cause of the confusion, and an attempt to mitigate that confusion by instituting a practice that is more similar to mainstream languages. We believe this problem is caused by the confluence of a several well-motivated design decisions that have created a very unusual system, and the solution is to require less declarations by leveraging ambient information in a manner more similar to how other languages' module systems work.

Rust requires users to build an explicit

@withoutboats
withoutboats / constraint-kinds.md
Last active January 9, 2023 17:14
Constraint Kinds in Rust

Notes on adding Constraint Kinds to Rust

Background: Constraint Kinds

a trait can be thought of as a type operator generating a "constraint" - what in Rust would usually be called a bound. For example:

// Declares a new item `Foo` with kind `type -> constraint`
trait Foo { }