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
Conversation
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? |
Started jenkins job pr-rangepos at https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1460/ |
jenkins job pr-rangepos: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1460/ |
Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2184/ |
jenkins job pr-scala-testsuite-linux-opt: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2184/ |
@@ -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 = { |
There was a problem hiding this comment.
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 = { ...
There was a problem hiding this comment.
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 = { ...
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
I'd like to get rid of the |
@@ -9,6 +9,8 @@ | |||
package scala.collection | |||
|
|||
import parallel.Combiner | |||
import parallel.TaskSupport | |||
import parallel.setTaskSupport |
There was a problem hiding this comment.
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}
@phaller |
Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2352/ |
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 = { |
There was a problem hiding this comment.
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.
jenkins job pr-scala-testsuite-linux-opt: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/2352/ |
jenkins job pr-rangepos: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/1621/ |
Other than the comment I made on the mailing list about adding new methods to collections, these changes look good to me. |
@@ -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) |
There was a problem hiding this comment.
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.
Except for my small comment about DRY, e.g., in |
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 |
@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):
Yes, that's exactly what I'm thinking about ... what is the sane approach/default here?
The same questions apply to the constructor case, but with the added issue that I can't add an constructor with a different name.
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,
Would love to hear your opinions on it! So this will still need a few revision ... I really want to get this right. |
Should we close this PR and hash out the design on the forums then reopen and/or resubmit once things are firmed up? |
Yes, I think hashing out the design (both on the forums and using new PRs) would be good, especially since |
No description provided.