James Kominick

Results 104 comments of James Kominick

There’s some context in #16 . The main complication being that the macros expand to a function definition and a static “once_cell” at the same level, and the static def...

That's _probably_ doable with the (similar) caveat that it would only work for structs defined at the top level so the cache can be defined. Another option that was touched...

This is tricky since the caches generated by the macros will always need to be at the global / `static` level. I'll need to sit on this for a little...

The macros basically expand to ``` lazy_static! { static CACHE: Arc = ...; } fn func(input: K) -> V { if let Some(v) = CACHE.lock().unwrap().get(&input) { return v.clone() } ......

Yeah, floats not implementing hash is just a pain point of the language. An alternative would be to specify a `convert` that returns a unique value (that does hash) from...

In order of my thoughts: (3): I think we should avoid implementing Serialize/Deserialize since we'd have to maintain that contract between library versions and that'd be a major pain. (2):...

I guess it's a bit redundant, but at least means you never need to disambiguate the calls with "fully qualified call syntax"

I'd be open to phasing in methods without the cache prefix and having their default implementations call the existing `cache_` methods until they are removed in the future.

when defining a cached fn ``` cached!{ COMPUTE: SizedCache = SizedCache::with_size(50); fn compute(a: u64, b: u64) -> u64 = { sleep(Duration::new(2, 0)); return a * b; } } ``` the...

I never got around to allowing the caller to specify `pub`/not-`pub` for the generated function or the cache itself. As of now, the generated function is `pub` and then cache...