Kotlin / kotlin-jupyter

Kotlin kernel for Jupyter/IPython
Apache License 2.0
1.1k stars 105 forks source link

Can not wildcard import enums #353

Open holgerbrandl opened 2 years ago

holgerbrandl commented 2 years ago

enum class ShiftID { A, B, WeekEnd }
import ShiftID.*

Expected: Since this is legit in kt and kts (clearly with the order of declaration and import being flipped), I'd assume this should to work also in a jupyter context. Observed It fails with an error image

Kotlin kernel v. 0.11.0.45, Kotlin v. 1.6.20-dev-6372

altavir commented 2 years ago

Interesting. The cause of this phenomenon is that currently kernel does not generate top level objects, instead all its contents are inside a genreated class like Script-something. So it could not be imported. It is just another case if favor of changing this behavior.

ileasile commented 2 years ago

Yes, fully qualified name for ShiftID is actually Line_X.ShiftID (X is some number). And it's all related to redesigning of scripting.

holgerbrandl commented 2 years ago

Thanks for the clarification.

Is there any timeline for improving the scripting model? Like 1.7 :-)? It's actually hard to teach kotlin via jupyter - at least for me - with such non-intuitive limitations wrt central language constructs.