Giter VIP home page Giter VIP logo

Comments (3)

hanszt avatar hanszt commented on May 28, 2024

See also Pull request 3961

from kotest.

AlexCue987 avatar AlexCue987 commented on May 28, 2024

Personally I feel the following code would be confusing to me, as well as to most developers:
val game = Game("Risk", listOf("p1", "p2", "p3", "p4")).shouldNotContainDuplicates()
should I ever encounter that, I'd rather refactor it like this:

val game = Game("Risk", listOf("p1", "p2", "p3", "p4"))
game. players.shouldNotContainDuplicates()

So I don't perceive this change as a big improvement.

from kotest.

hanszt avatar hanszt commented on May 28, 2024

I see what you mean.

But as a more general guidline: Isn't it more desirable to have a return type that is more specific?

Something on the line of this post: https://stackoverflow.com/questions/3434367/is-it-better-to-return-the-most-specific-or-most-general-type-from-an-action-met

This makes the use of these functions more flexible don't you think? Especially in light of the first example above?
I'm curious what you think

from kotest.

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.