wcaokaze
05/24/2018, 3:26 PMbenleggiero
05/25/2018, 1:00 AMpackage foo.bar.baz implicitly invents the package foo.bar.baz and places this file in it, then why not make module Baz do the same thing? Why require a build system or compiler flag?benleggiero
05/25/2018, 1:02 AMimport ModuleName : packagename needs to be there. Why not just import packagename? Why must both be specified?wcaokaze
05/25/2018, 1:08 AMimport from another module.wcaokaze
05/25/2018, 1:12 AMmodule Baz is better, I agree. But then how do we specify the actual package name (on JVM) ?wcaokaze
05/25/2018, 2:06 AMwcaokaze
05/25/2018, 2:07 AMmodule-info.kt like Java? Isn’t it pragmatic?gildor
05/25/2018, 2:53 AMgildor
05/25/2018, 2:53 AMgildor
05/25/2018, 2:53 AMgildor
05/25/2018, 2:54 AMgildor
05/25/2018, 2:57 AMgildor
05/25/2018, 2:58 AMApp or app,
so:
import com.wcaokaze.app.util.*
becomes
import app.util.*
instead of proposed
import App : utilwcaokaze
05/25/2018, 3:12 AMimport without module names will continue to be available.wcaokaze
05/25/2018, 3:13 AMgildor
05/25/2018, 3:23 AMModuleName as basic package name instead of com.wcaokaze.modulename, there is a lot of libraries that do thatgildor
05/25/2018, 3:23 AMgildor
05/25/2018, 3:25 AMimport android.view
import android.widgetso this import all the members of android,view and widget packages to your code recursively? Looks really scary
gildor
05/25/2018, 3:26 AMwcaokaze
05/25/2018, 3:42 AMModuleName as basic package name?
There is import Twitter : timeline in my “ideal imports”. Do you mean I should use import twitter.timeline.fetchHomeTimeline, for example?wcaokaze
05/25/2018, 3:47 AMwcaokaze
05/25/2018, 3:47 AMgildor
05/25/2018, 5:29 AMimport twitter.timeline.fetchHomeTimeline or just import twitter.fetchHomeTimeline if you really don’t care about additional package and just have class Timeline with this function in twitter packagegildor
05/25/2018, 5:32 AMis better, I agree. But then how do we specify the actual package name (on JVM) ?module Baz
import baz, just use short package name without revered domain prefix, no need to invent modulesbenleggiero
05/26/2018, 3:11 PMpackage com.wcaokaze.app.activity.twitter.home
import android.app.Activity
import android.os.Bundle
import android.view.*
import android.widget.EditText
import android.widget.ImageView
import android.widget.TextView
import android.support.v7.widget.RecyclerView
import android.util.*
import com.wcaokaze.app.R
import com.wcaokaze.app.widget.TimelineRecyclerViewAdapter
import com.wcaokaze.app.util.*
import com.wcaokaze.app.util.view.*
import com.wcaokaze.app.util.layout.dsl.*
import com.wcaokaze.cachemodule.StatusCacheManager
import com.wcaokaze.cachemodule.UserCacheManager
import com.wcaokaze.twittermodule.Status
import com.wcaokaze.twittermodule.User
import com.wcaokaze.twittermodule.timeline.fetchHomeTimeline
import java.util.*
import kotlinx.coroutines.experimental.async
import kotlinx.coroutines.experimental.launch
import kotlinx.coroutines.experimental.android.UI
Ideal:
module App
package activity.twitter.home
import module Twitter
import module Cache
import module App
import module Android
import module Kotlinx.Coroutines
import java.util.*wcaokaze
05/26/2018, 3:24 PMbenleggiero
05/26/2018, 3:57 PMimport LatteFX.*). Ambiguity is actually very rare, and easily resolved at the call sitewcaokaze
05/26/2018, 4:24 PMLatteFX.Foo is easily but com.wcaokaze.module.Foo is not.
In conclusion, is it best solution to use package name without domain prefix?wcaokaze
05/26/2018, 4:27 PMimport as to resolve ambiguitybenleggiero
05/26/2018, 7:02 PMwcaokaze
05/26/2018, 7:39 PMimport module Android looks scary I thinkbenleggiero
05/26/2018, 8:56 PMimport Cocoa or #import <Cocoa/Cocoa.h>. That's the entirety of the macOS development platform, and just a couple characters different from the entire iOS platform.
And those don't really affect compilation times. I'm not 100% sure what the technical difference is with JVM imports, but I feel like, since IntelliJ already searches through everything even if it's not imported, JB can make Kotlin do the same and only encode the necessary imports into the bytecodewcaokaze
05/27/2018, 4:01 AMmodule App
package activity.twitter.home
Which the actual package (on JVM) will the file belong to?benleggiero
05/27/2018, 5:30 AMwcaokaze
05/27/2018, 6:45 AMpackage com.wcaokaze.app.activity.twitter.home will become package activity.twitter.home since the module's "root package" is com.wcaokaze.app.wcaokaze
05/27/2018, 6:46 AMpackage declarations always have full name, right?gildor
05/27/2018, 7:02 AMgildor
05/27/2018, 7:11 AMJB can make Kotlin do the same and only encode the necessary imports into the bytecodeIsn't this "compile time penalty"? Compiler should infer target class/member of class on comile time and include to bytecode. But not like IDE, which works only with a single file, but actually do this for all files of project each time (or you need some support of incremental resolution if you want to somehow reduce penalty) I just thing it's fight with non-existent problem. Kotlin plugin is really good helper with dependency, I never import manually and I always know which class/function I just imported