GithubHelp home page GithubHelp logo

Comments (4)

kalaninja avatar kalaninja commented on May 18, 2024

it is a good example, though I think that adding extra logic to the method will make it not so lightweight as we try to keep it. I suggest to implement this logic in plinq api, which is probable to happen sometime in the future.

from go-linq.

ahmetb avatar ahmetb commented on May 18, 2024

@kalaninja Agreed. Normally, we could have ForEach and ForEachAsParallel, but I bet most people will get the job done with a simple go f() inside ForEach + sync.WaitGroup

Personally, if I have a slice of 100,000 items, I don‘t want ForEach to create a goroutine for each of them in the background (this is an easy way to run out of file descriptors on linux and crash your program).

I feel most Go programmers want to have finer control over their concurrency code. For instance instead of running 100,000 goroutines concurrently, I can develop a system that would control max concurrent jobs etc. I think I'd like to see a simpler design which we can incorporate, before tagging v3.0.

As per the design I think I am fine with @kalaninja's original design which was:

  • func (Query) ForEach(func(v interface{})
  • func (Query) ForEachIndexed(i int, func(v interface{})
  • ForEachT, ForEachIndexedT

Thoughts?

from go-linq.

ahmetb avatar ahmetb commented on May 18, 2024

Closing this as #57 is merged.

@kalaninja If your commit message (not the title) or the PR descriptionincludes Closes #58, such issues will be automatically closed. More info:

https://help.github.com/articles/closing-issues-via-commit-messages/
https://github.com/blog/1506-closing-issues-via-pull-requests

from go-linq.

kalaninja avatar kalaninja commented on May 18, 2024

thanks @ahmetalpbalkan. I always forget about this feature when commiting changes

from go-linq.

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.