Move all the APIs to single package?

32 views
Skip to first unread message

Maxim Shafirov

unread,
Apr 5, 2013, 3:41:12 AM4/5/13
to karafr...@googlegroups.com
With a bit of practical usage of Kara in real project it appears very inconvenient having to import right combination of kara.[views, styles, controllers].*
For instance, when you're to apply multiple classes to a tag you do:
div(c1 + c2 + c3) {
}

and it says + is only defined on Strings. You are to know Kara really well to solve this by importing kara.controllers.*

So, what do you think if we just have one kara.* ?

Max

Andy Selvig

unread,
Apr 5, 2013, 10:54:06 AM4/5/13
to Maxim Shafirov, karafr...@googlegroups.com
I've thought about this several times as well. There's definitely some friction with having to import a bunch of different packages, although IDEA helps mostly with that. I think that operator overloading is one of the exceptions where the IDE can't know what to do.

So the obvious downside to this is that we greatly increase the risk of name conflicts. It also makes it a bit tougher to navigate the source code, as package names will no longer correspond to directories. However, if we think that the advantages outweigh the negatives, we should go for it. Does anyone have any strong objections?

As an aside, it seems like this is a great place for Kotlin to step in handle this in the language. It would be neat if one could do a recursive package import:

import kara.*.*

This way we give the end user a way to make their lives easier, but still let us maintain a sane package structure. 


--
You received this message because you are subscribed to the Google Groups "Kara Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to karaframewor...@googlegroups.com.
To post to this group, send email to karafr...@googlegroups.com.
Visit this group at http://groups.google.com/group/karaframework?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Andy Selvig

unread,
Apr 11, 2013, 10:46:12 AM4/11/13
to Maxim Shafirov, karafr...@googlegroups.com
Apparently Kotlin will soon have module-level default imports:


I think this pretty much addresses the issue, without doing any refactoring of Kara. We just need to setup a proper module import when generating new projects.

Reply all
Reply to author
Forward
0 new messages