kobalt icon indicating copy to clipboard operation
kobalt copied to clipboard

Add a top-level scope for Kobalt code

Open kmruiz opened this issue 9 years ago • 5 comments

Add a kobalt directive so you can declare the kobalt build file without using top-level variables.

For example:

val re = repos()
val pl = plugins()

val  pr = project { ... does something }

Could be written as:

val kb = kobalt {
   repos(...)
   plugins(...)
   project {
      ...
   }
}

kmruiz avatar May 06 '16 08:05 kmruiz

Interesting suggestion, I like it! I'd like to get more opinions, will ping the channel.

cbeust avatar May 06 '16 15:05 cbeust

Why even require declaring variables in the first place?

To modify the above examples:

repos()
plugins()

project {}

and

kobalt {
  repos()
  plugins()

  project {
  }
}

EddieRingle avatar May 06 '16 16:05 EddieRingle

The problem is that Kotlin now doesn't support top-level expressions without assigning them to a variable :(

kmruiz avatar May 06 '16 16:05 kmruiz

@EddieRingle: That's not a valid Kotlin file.

It would (probably) be a valid Kotlin script but these are not supported yet.

cbeust avatar May 06 '16 16:05 cbeust

@kmruiz @cbeust Whoops, forgot about that. Darn. :(

EddieRingle avatar May 06 '16 17:05 EddieRingle