Closed tversteeg closed 3 years ago
load_and_compile_str
is actually intended to be a private API - anything marked #[doc(hidden)]
is not for public consumption.
The sanctioned ways to evaluate a string are either of the following:
let three: u8 = eval!("(+ 1 2)")?;
let three: u8 = glsp::eval_multi(&glsp::parse_all("(+ 1 2)", None)?, None)?;
I previously had a glsp::load_str
function, but I got rid of it because the crate already has ten other APIs for evaluating or expanding data. I was worried that glsp::load_str
and glsp::eval_str
would make a confusing topic even more murky, especially because they would imply the existence of glsp::load_and_compile_str
, glsp::expand_str
, (load-str)
and (eval-str)
.
...however, I'm conscious that eval!
is hidden behind a feature flag, and the eval_multi
/parse_all
combo above is as ugly as sin. The correct choice here isn't obvious - I'll have a think about it.
That clarifies it for me, but coming into it freshly it's kind of confusing.
The reason I'm asking for this feature is because I'm trying to create a game for a WebAssembly target with miniquad so I can't use your file API.
glsp::load_str
, and the equivalent (load-str)
function, were added in 5280bb5 :)
There are two functions called
load_and_compile
andload_and_compile_str
, but there doesn't seem to be an equivalent_str
form forload
.Do I have to load from a string using other functions?
Would you accept a PR with an implementation of
load_str
?