-- Leo's gemini proxy
-- Connecting to agnos.is:1965...
-- Connected
-- Sending request
-- Meta line: 20 text/gemini;lang=en-US
> Published: 2024-03-26T19:08:31+01:00
The AI game can now limit output using the gbnf_limit feature, but it requires dynamic trait objects for this. Rather than generating a so-called "limit struct" with proper concrete types, the code relies on using dynamic typing of anything that can produce a GbnfLimit. This makes the code easier to understand, but creating limit structs does is not ergonomic:
Lots of Box::new.
Performance implications of dynamic dispatch.
I am trying to fix this on a separate branch that is not yet uploaded to the Git repository, because it's a giant mess. I have made some progress, but I'm running into the limitations of Rust's (very powerful) generics system. Namely, blanket traits are not so specific: an impl for Option<T> also counts as an impl for Option<Vec<T>>. This can be solved by something called "trait specialization," but that's an unstable nightly-only feature and has its own set of issues.
I have almost worked out a way to make the concrete types work. But much like the initial implementation of the GBNF grammar generator, I've sort of hit a roadblock due to trying to remove dynamic dispatch.
I hope to return to the AI game soon and get the dynamic dispatch fully removed from GBNF Limit code, so development on at least one interactive command can resume!
License: CC-BY-SA-4.0.
‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗‗
-- Response ended
-- Page fetched on Thu May 23 09:53:48 2024