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
structStruct {
a string
}
fndecode_string[T]() bool {
$if T isstring {
asserttruereturntrue
} $else {
assertfalse
}
returnfalse
}
fndecode[T](val T) {
// feature requestedassert decode_string[typeof(T.$('a')).idx]()
// orassert decode_string[typeof(T.$('a'))]()
/* This make sense if allow use a field type to init a new variable. Example:*/gg:=typeof(T.$('a')){}
}
fnmain() {
struc:= Struct{}
decode(struc)
}
This discussion was converted from issue #17796 on June 27, 2023 10:01.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Describe the feature
Get the type of a structure's field
Use Case
Allow use a unknow type without init a new var.
minimal example
Proposed Solution
No response
Other Information
No response
Acknowledgements
Version used
V 0.3.3 5e48817
Environment details (OS name and version, etc.)
Ubuntu
Beta Was this translation helpful? Give feedback.
All reactions