Coder Social home page Coder Social logo

Comments (4)

stephencelis avatar stephencelis commented on June 12, 2024 4

Ha, we actually made concat a lil more "swifty" in order to support trailing closures.

concat(buttonStyle) {
  $0.backgroundColor = .red
}

// vs.

concat(buttonStyle, and: {
  $0.backgroundColor = .red
})

This is a bit of a cheat code, but it works with concat as it scales to its variadic number of arguments.

concat(a, b, c, d, e, f, and: g)

The pipe and chain functions also are overloaded to create larger pipelines. I'm not sure what to do about scaling them, though:

pipe(a, into: b, then: c, before: d, andThen: e)

I'm also not sure if these kinds of labels are readable together. E.g., using with makes the meaning less clear:

with(x, pipe(incr, into: square))

I think in general the goal of these functions is to reduce visual noise and focus on the pipeline and composition. It should also be easy to manipulate existing pipelines and plug a new function into them anywhere, which is a flexibility that seems at odds with adding argument labels.

pipe(a, b, c, d, e)

We're up to discuss ideas that address these problems, though!

from swift-overture.

jbarros35 avatar jbarros35 commented on June 12, 2024 4

I'm using it just to say that's a huge achievement and work, I'm reading it and impress, do you had a Medium article about it?
That's a game change for Swift. I'm pretty sure that work will have recognition in the future when people would be aware of these workings.
By the way, if you allow me I want to contribute creating more test cases for improving your code coverage tests.
Thank you!
screen shot 2018-04-21 at 10 12 50

from swift-overture.

gmosx avatar gmosx commented on June 12, 2024

Heh, you got me confused. I am also not sure what is the best API after all ;-)

from swift-overture.

stephencelis avatar stephencelis commented on June 12, 2024

Going to close this for now. Thanks for the discussion! Feel free to make suggestions for any other specific API changes by opening a new issue 😄

from swift-overture.

Related Issues (17)

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.