Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

Implicit conversions #335

Closed
eskatos opened this issue Apr 18, 2017 · 3 comments
Closed

Implicit conversions #335

eskatos opened this issue Apr 18, 2017 · 3 comments

Comments

@eskatos
Copy link
Member

eskatos commented Apr 18, 2017

Some Gradle DSL properties would benefit from implicit type safe conversions.

For example, to define a maven repository one has to:

repositories {
  maven { url = uri("...") }
}

The call to project.uri('...') converts a String to an URI.

With implicit conversions one could simply write:

repositories {
  maven { url = "..." }
}

One possible way to achieve this could be with implicit conversion compiler plugins, see #256 (comment). This would provide complete parity with Groovy with the advantage of compile time checking.

@JLLeitschuh
Copy link
Contributor

As it stands right now, this works right now:

repositories {
  maven { setUrl("...") }
}

I'm not a fan of this either

@eskatos
Copy link
Member Author

eskatos commented Jun 1, 2017

Also see #380 (KT-4075)

@sdeleuze
Copy link

sdeleuze commented Aug 16, 2017

I am not sure I like the idea of introducing implicit conversions to Kotlin ... It can be useful but also confusing, Kotlin statically type nature is a key point, that's maybe too much magic for my taste.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants