This worked fine. Coming from python, my natural i...
# advent-of-code
n
This worked fine. Coming from python, my natural instinct to extend this for two years was, I created a folder called 2020, and a folder called 2021, and had the same stuff in each one. The problem is that kotlin packages aren't intrinsically hierarchical. So if I have a file called day1.kt in both the 2020 and 2021 folder, and they both have package day1 at the top, and both define same function names, it starts complaining about duplicate function definitions
m
you can just change the packages to be
y2021.day1
, etc. while leaving the files untouched
n
got it. i tried something like that but just with 2021, and i guess it complained that it's not a legal identifier
thanks!
m
hmm weird…I thought digits were legal after at least one letter
n
yeah I tried to do
package 2021.day1
i mean
now I seem to be running into a compiler bug where it's using some kind of stale intermediate file... it's still erroring out even though I changed the package name
I tried to invalidate caches + restart, would you happen to know how to force a clean rebuild?
ah nm I deleted and recreated some files and it got unconfused 🙂
m
cool! sorry for being late. Nice you solved it!
depending on the build tool you can just run
mvn clean
or
gradle clean
otherwise if it’s an IDE-only project, without build tools, you can launch the menu command Build > Rebuild Project
👍 1
e
you can make any character sequence an identifier with backticks, e.g.
Copy code
package `2021`.day1
but I do not recommend it
🚀 1
(not quite "any"; at that point it depends on platform limitations, not the Kotlin language itself)