Quantcast

Magic conversion of properties to methods

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Magic conversion of properties to methods

pledbrook
Hi,

While developing a course and exploring the Gradle API, something
strange has come to my attention. As an example, check out the API
docs for MavenArtifactRepository:

    http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.repositories.MavenArtifactRepository.html

As far as I can tell, it definitely says that `url` is a property. And
yet the DSL example look like:

    repositories {
        maven {
            url "file:///var/tmp/repo"
        }
    }

That definitely looks like a method to me. What's going on here? Does
this magic apply to all DSL properties, or a sub-set of them? Or are
the docs just wrong (seems unlikely)?

It may be a small thing, but it feels like an inconsistency between
different parts of the documentation that is bound to cause some level
of uncertainty and confusion (certainly is for me).

Thanks,

Peter

--
Peter Ledbrook
t: @pledbrook
w: http://www.cacoethes.co.uk/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Magic conversion of properties to methods

erdi
Interesting that it pops up for the second time in two weeks. See this thread: http://markmail.org/message/evs3ztkrfjc4cl4i.


On Thu, Aug 28, 2014 at 3:40 PM, Peter Ledbrook <[hidden email]> wrote:
Hi,

While developing a course and exploring the Gradle API, something
strange has come to my attention. As an example, check out the API
docs for MavenArtifactRepository:

    http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.repositories.MavenArtifactRepository.html

As far as I can tell, it definitely says that `url` is a property. And
yet the DSL example look like:

    repositories {
        maven {
            url "file:///var/tmp/repo"
        }
    }

That definitely looks like a method to me. What's going on here? Does
this magic apply to all DSL properties, or a sub-set of them? Or are
the docs just wrong (seems unlikely)?

It may be a small thing, but it feels like an inconsistency between
different parts of the documentation that is bound to cause some level
of uncertainty and confusion (certainly is for me).

Thanks,

Peter

--
Peter Ledbrook
t: @pledbrook
w: http://www.cacoethes.co.uk/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Magic conversion of properties to methods

pledbrook
> Interesting that it pops up for the second time in two weeks. See this
> thread: http://markmail.org/message/evs3ztkrfjc4cl4i.

Thanks for that. I'd be in favour of deprecating the syntax to be
honest. Do you think I should recommend the property syntax on my
course? Or the method-based one?

Cheers,

Peter

--
Peter Ledbrook
t: @pledbrook
w: http://www.cacoethes.co.uk/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Magic conversion of properties to methods

erdi
From what I recall the decision was not to promote the method-based syntax as it's confusing to the users - you being an example. So I would say use the property syntax.


On Thu, Aug 28, 2014 at 7:20 PM, Peter Ledbrook <[hidden email]> wrote:
> Interesting that it pops up for the second time in two weeks. See this
> thread: http://markmail.org/message/evs3ztkrfjc4cl4i.

Thanks for that. I'd be in favour of deprecating the syntax to be
honest. Do you think I should recommend the property syntax on my
course? Or the method-based one?

Cheers,

Peter

--
Peter Ledbrook
t: @pledbrook
w: http://www.cacoethes.co.uk/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Magic conversion of properties to methods

Luke Daley-2
No strong “official” decision has been made either way.

My personal recommendation is the same as Marcin’s.

On 29 August 2014 at 6:48:49 am, Marcin Erdmann ([hidden email]) wrote:

From what I recall the decision was not to promote the method-based syntax as it's confusing to the users - you being an example. So I would say use the property syntax.


On Thu, Aug 28, 2014 at 7:20 PM, Peter Ledbrook <[hidden email]> wrote:
> Interesting that it pops up for the second time in two weeks. See this
> thread: http://markmail.org/message/evs3ztkrfjc4cl4i.

Thanks for that. I'd be in favour of deprecating the syntax to be
honest. Do you think I should recommend the property syntax on my
course? Or the method-based one?

Cheers,

Peter

--
Peter Ledbrook
t: @pledbrook
w: http://www.cacoethes.co.uk/

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email




Loading...