You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Hi @TheDan64, I've been working through Kaleidoscope's tutorial with inkwell and realized that I couldn't simply grab a parameter's name. e.g. I wanted to do something like the below
let the_fn: FunctionValue = ...
...
for param in the_fn.get_param_iter() {
// I want to use param.get_name() here!
self.named_values.insert(param.get_name(), param.as_any_value_enum());
}
Because function parameter's should be float valued in Kaleidoscope, I can simply check the param type with is_float_value() and then cast it with into_float_value() if that check succeeds, then I can use FloatValue's get_name(). i.e.,
let param_as_float: FloatValue = if param.is_float_value() {
Ok(param.into_float_value())
} else {
Err( ... )
}?;
let param_name = param_as_float
.get_name()
.to_str()
...
So it seems you can work around it, it just doesn't feel as ergonomic.
Describe the solution you'd like
I haven't thought about solutions here. I did see an old thread where get_name() was mentioned, so thought I'd re-raise it since it's been a few years.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Hi @TheDan64, I've been working through Kaleidoscope's tutorial with inkwell and realized that I couldn't simply grab a parameter's name. e.g. I wanted to do something like the below
Because function parameter's should be float valued in Kaleidoscope, I can simply check the param type with
is_float_value()
and then cast it withinto_float_value()
if that check succeeds, then I can useFloatValue
'sget_name()
. i.e.,So it seems you can work around it, it just doesn't feel as ergonomic.
Describe the solution you'd like
I haven't thought about solutions here. I did see an old thread where
get_name()
was mentioned, so thought I'd re-raise it since it's been a few years.The text was updated successfully, but these errors were encountered: