在Kotlin中使用eval关键字 [英] Use of eval keyword in Kotlin

查看:545
本文介绍了在Kotlin中使用eval关键字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在kotlin进行安全投射和智能投射时, eval()的用途是什么?

What is use of eval() during safe cast and smart cast in kotlin?

是否相似到 eval()以便我们在javascript,python或任何其他语言中使用?

Is it similar to eval() which we use in javascript, python or any other language?

推荐答案

eval()函数仅可以在Kotlin / JS中找到,并且只需调用JavaScript eval( )函数。

The eval() function is only available in Kotlin/JS , and simply calls the JavaScript eval() function.

这意味着您不能在可能要在Kotlin / JVM或Kotlin / Native上运行的代码中使用它。

This means you can't use it in code you might want to run on Kotlin/JVM or Kotlin/Native.

(此外,虽然我对Kotlin / JS不熟悉,但我想那可能很强大,也很危险,所以也许要小心……)

(Also, while I'm not familiar with Kotlin/JS, I'd imagine that could be quite powerful and also quite dangerous, so maybe caution is indicated…)

这篇关于在Kotlin中使用eval关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆