Kotlin / Kotlin/kotlin-script-examples
request: sample to get return value of eval
- Dominant language
- Kotlin
- Stars
- 339
- Forks
- 48
- PR merge metrics
- No merged PRs in 30d
Description
can you add sample to get return value of eval() ?
something like this:
```
val result : ResultWithDiagnostics = eval(...)
result.castOrError> {
"script evaluation failed. $it"
}.value.returnValue.castOrError {
"script evaluation result is $it"
}.value.castOrError { // your expected class for value
"script returns value, but it's not AppConfig. ${it?.javaClass?.simpleName}"
}.let { config = it }
inline fun Any?.castOrError(noinline messageCreator:(Any?)->String) =
(this as? T) ?: error(messageCreator(this))
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the repository's existing Kotlin script examples and the eval() usage. Add a sample showing how to retrieve and type-check an evaluation return value using the requested ResultWithDiagnostics flow, then verify that the example is consistent with the repository's existing examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100