Giter Site home page Giter Site logo

Comments (11)

anshbansal avatar anshbansal commented on September 26, 2024

It would be nice if the button for editing on github is also added to this page. Else add an entry in README

from groovy-website.

anshbansal avatar anshbansal commented on September 26, 2024

"you may be surprise to see " => Should be surprised

from groovy-website.

anshbansal avatar anshbansal commented on September 26, 2024

"first the constructor is called, then the setters are called in turn" -> "the setters are called in the sequence in which they are specified in the map"

The sequence might matter in some cases. I am commenting as I keep on reading else I'll forget.

from groovy-website.

anshbansal avatar anshbansal commented on September 26, 2024

"Last but not least, prefer using single quoted strings when you need string constants". It would be good to add why this should be done. I think it is performance. Is there anything else?

from groovy-website.

anshbansal avatar anshbansal commented on September 26, 2024

assert 'foo' =~ pattern

It should be
assert 'foo' ==~ pattern

Running the first I got java.util.regex.Matcher[pattern=fo* region=0,3 lastmatch=]. Running the second I got true

from groovy-website.

anshbansal avatar anshbansal commented on September 26, 2024

case { it > 3 } should be case { it > 3 }:. Missing colon.

from groovy-website.

anshbansal avatar anshbansal commented on September 26, 2024

"If you don’t really care of the exception" => "care about the type of exception"

from groovy-website.

anshbansal avatar anshbansal commented on September 26, 2024

bump

from groovy-website.

melix avatar melix commented on September 26, 2024

The docs are in https://github.com/apache/incubator-groovy/blob/master/src/spec/doc/style-guide.adoc

Regarding assert 'foo' =~ pattern, it is not really an error, because of Groovy truth.

from groovy-website.

anshbansal avatar anshbansal commented on September 26, 2024

@melix But wouldn't that be always true and hence beat the point of the assert?

from groovy-website.

PascalSchumacher avatar PascalSchumacher commented on September 26, 2024

@anshbansal No, the groovy truth requires the matcher to have at least one match to be considered true:
assert ('a' =~ /a/)

If the matcher does not have a match it is considered false:

assert !('a' =~ /b/)

http://docs.groovy-lang.org/latest/html/documentation/#_matchers

from groovy-website.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.