Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SI-6998 Improvements to the task-support API #1937

Closed
wants to merge 1 commit into from
Closed

Conversation

soc
Copy link
Member

@soc soc commented Jan 20, 2013

No description provided.

@soc
Copy link
Member Author

soc commented Jan 20, 2013

I'm trying to get the debate started again here: https://groups.google.com/d/topic/scala-internals/lzxVlexkqEg/discussion

Everyone involved (@axel22, @jsuereth, @retronym, ...) in the discussion of #930, could you comment whether this is going into the right direction?

@scala-jenkins
Copy link

Started jenkins job pr-rangepos at https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1460/

@scala-jenkins
Copy link

jenkins job pr-rangepos: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1460/

@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2184/

@scala-jenkins
Copy link

jenkins job pr-scala-testsuite-linux-opt: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2184/

@heathermiller
Copy link
Member

Given that both @axel22 and @phaller are the parallelism/library guys, I would suggest that @phaller also provide a review on this one.

@@ -50,9 +50,10 @@ package object parallel {

val defaultTaskSupport: TaskSupport = getTaskSupport

def setTaskSupport[Coll](c: Coll, t: TaskSupport): Coll = {
def setTaskSupport[Coll](c: Coll, taskSupport: TaskSupport): Coll = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming parameters breaks binary compatibility. It this is necessary (though it seems like just a matter of personal preference to me), you've got to use @deprecatedName. For example...

    def setTaskSupport[Coll](c: Coll, @deprecatedName('t) taskSupport: TaskSupport): Coll = { ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming parameters breaks binary compatibility. It this is necessary (though it seems like just a matter of personal preference to me), you've got to use @deprecatedName. For example...

    def setTaskSupport[Coll](c: Coll, @deprecatedName('t) taskSupport: TaskSupport): Coll = { ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does break compatibility, albeit of the source kind. Not that that is
any better.

On Monday, January 21, 2013, Heather Miller wrote:

In src/library/scala/collection/parallel/package.scala:

@@ -50,9 +50,10 @@ package object parallel {

val defaultTaskSupport: TaskSupport = getTaskSupport

  • def setTaskSupport[Coll](c: Coll, t: TaskSupport): Coll = {
  • def setTaskSupport[Coll](c: Coll, taskSupport: TaskSupport): Coll = {

Renaming parameters breaks binary compatibility. It this is necessary
(though it seems like just a matter of personal preference to me), you've
got to use @deprecatedName. For example...

def setTaskSupport[Coll](c: Coll, @deprecatedName('t) taskSupport: TaskSupport): Coll = { ...


Reply to this email directly or view it on GitHubhttps://github.com//pull/1937/files#r2715869.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is actually worse for 2.10 -> 2.11, usually we try to maintain as much source compat as possible.

@soc
Copy link
Member Author

soc commented Jan 21, 2013

I'd like to get rid of the setTaskSupport method completely ... would it be acceptable to pass the taskSupport value in the constructor instead?

@@ -9,6 +9,8 @@
package scala.collection

import parallel.Combiner
import parallel.TaskSupport
import parallel.setTaskSupport
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better: import parallel.{Combiner, TaskSupport, setTaskSupport}

@soc
Copy link
Member Author

soc commented Jan 25, 2013

@phaller
Thanks a lot!

@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2352/

@scala-jenkins
Copy link

Started jenkins job pr-rangepos at https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1621/

@@ -50,9 +51,10 @@ package object parallel {

val defaultTaskSupport: TaskSupport = getTaskSupport

def setTaskSupport[Coll](c: Coll, t: TaskSupport): Coll = {
def setTaskSupport[Coll](c: Coll, @deprecatedName('t) taskSupport: TaskSupport): Coll = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good, you found @deprecatedName.

@scala-jenkins
Copy link

jenkins job pr-scala-testsuite-linux-opt: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2352/

@scala-jenkins
Copy link

jenkins job pr-rangepos: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1621/

@axel22
Copy link
Member

axel22 commented Jan 28, 2013

Other than the comment I made on the mailing list about adding new methods to collections, these changes look good to me.

@JamesIry
Copy link
Contributor

JamesIry commented Feb 1, 2013

@axel22 can you link to the mailing list comments, or summarize here?

@phaller have all your issues been addressed?

@retronym, @jsuereth you guys are listed as reviewers, do you feel a need to weight in?

@@ -56,6 +58,9 @@ extends AbstractMap[A, B]

override def par = new ParHashMap[A, B](hashTableContents)

override def parWith(implicit taskSupport: TaskSupport) =
setTaskSupport(new ParHashMap[A, B](hashTableContents), taskSupport)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're still repeating yourself here: the expression new ParHashMap[A, B](hashTableContents) is copied verbatim. Why? Method par already does that.

@phaller
Copy link
Contributor

phaller commented Feb 1, 2013

Except for my small comment about DRY, e.g., in mutable.HashMap (sorry for being so persistent), it looks promising to me. Now, if the parameter of parWith is implicit I don't understand why we couldn't fold that into par. (We're allowed to break binary compatibility in 2.11.)

@soc
Copy link
Member Author

soc commented Feb 1, 2013

It will break source compatibility and it will be worse than Java, which manages to handle this task without configuration.

But I will reconsider all solutions and come up with a new proposal, considering that parWith is a terrible name if the argument is implicit.

@soc
Copy link
Member Author

soc commented Feb 1, 2013

@jsuereth Mailing list is https://groups.google.com/d/topic/scala-internals/lzxVlexkqEg/discussion

Current issues (https://groups.google.com/d/msg/scala-internals/lzxVlexkqEg/qLnBWPOy26cJ):


I think that in principle setting those through constructor calls should work. It might require adding the task support parameter to newCombiner, though, or introduce an overload of newCombiner.

Yes, that's exactly what I'm thinking about ... what is the sane approach/default here?

newCombiner + newCombinerWith(implicit taskSupport)
newCombiner + newCombinerWith(taskSupport)
newCombiner(implicit taskSupport)
newCombiner(taskSupport)
newCombiner(taskSupport = defaultTS)
  1. would be the same way as we do for par/parWith but I'm a bit concerned that people don't realize that their implicit taskSupport is used for more stuff than just par/parWith
  2. would require setting it explicitly
  3. would add an implicit argument to the existing method, will break binary compatibility
  4. would add an argument to the existing method, will break source and binary compatibility
  5. would add an default argument to the existing method, will break binary compatibility and would not be in line with the approach taken with par/parWith

The same questions apply to the constructor case, but with the added issue that I can't add an constructor with a different name.

new ParColl(coll, taskSupport)
new ParColl(coll, implicit taskSupport)
new ParColl(coll)(implicit taskSupport)
new ParColl(coll, taskSupport = defaultTS)
new ParColl(coll) + new ParColl(coll, taskSupport)
...

I just realized an additional issue with the “let's add with”-approach when implicit/default methods are used: If the argument is not given explicitly, parWith and friends look horrible!

someCollection.parWith.map(...).filter(...)

Would love to hear your opinions on it!


So this will still need a few revision ... I really want to get this right.

@JamesIry
Copy link
Contributor

JamesIry commented Feb 6, 2013

Should we close this PR and hash out the design on the forums then reopen and/or resubmit once things are firmed up?

@phaller
Copy link
Contributor

phaller commented Feb 6, 2013

Yes, I think hashing out the design (both on the forums and using new PRs) would be good, especially since TaskSupport is going to play a much bigger role in the public API, so we should review its API as well I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
9 participants