scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

Improve scaladoc of ProductXX and FunctionXX (patches included) #4021

Closed scabug closed 13 years ago

scabug commented 13 years ago

Scaladoc of Product, ProductXX and FunctionXX could be better; docs are inconsistent and imprecise

Two patches included (both apply against [r23561]):

  1. ProductAndGenProd.diff.gz - this has some changes to Product.scala and genprod.scala. Doc improvements include consistency, correctness, and completness
  2. ProductFunctionGenerated.diff.gz - this is the results of running genprod on the codebase; I couldn't find a way to do this from the ant file, but things seem to work more or less.
scabug commented 13 years ago

Imported From: https://issues.scala-lang.org/browse/SI-4021?orig=1 Reporter: Dave Copeland (davetron5000) Attachments:

scabug commented 13 years ago

Dave Copeland (davetron5000) said: Applies against 23561 to update docs in Product and code in genprod to do same

scabug commented 13 years ago

Dave Copeland (davetron5000) said: Applies against 23561 that is the results of running genprod mod from previous patch

scabug commented 13 years ago

Dave Copeland (davetron5000) said: Examples of the wording that this version of genprod products:

== FunctionXX ==

def curried : (T1) ⇒ (T2) ⇒ (T3) ⇒ (T4) ⇒ R Returns a curried version of this function.

returns a function f such that f(x1)(x2)(x3)(x4) == apply(x1, x2, x3, x4)

def tupled : ((T1, T2, T3, T4)) ⇒ R Returns a version of this function that takes a Tuple4 as its argument instead of 4 arguments.

returns a function f such that f((x1, x2, x3, x4)) == f(Tuple4(x1, x2, x3, x4)) == apply(x1, x2, x3, x4)

def andThen [A] (g: (R) ⇒ A) : (T1) ⇒ A Returns a function taking one argument that applies g to this function applied to the argument.

returns a function f such that f(x) == g(apply(x))

== ProductXX ==

def _2 : T2 Returns a projection of element 2 of this product.

returns a projection of element 2

def productElement (n: Int) : Any Returns the n-th projection of this product if 0 < n <= productArity, otherwise throws an IndexOutOfBoundsException.

n number of the projection to be returned

returns same as ._(n+1), for example productElement(1) is the same as ._1.

scabug commented 13 years ago

@dragos said: Thank you for your patch. Please make sure you sign and send us the Scala Contributor Agreement, if you haven't done it already:

http://www.scala-lang.org/sites/default/files/contributor_agreement.pdf

scabug commented 13 years ago

@dragos said: (In r23577) Applied patch from davetron5000, improving documentation on ProductN and FunctionN traits. Closes #4021.

scabug commented 13 years ago

Dave Copeland (davetron5000) said: Replying to [comment:4 dragos]:

Thank you for your patch. Please make sure you sign and send us the Scala Contributor Agreement, if you haven't done it already:

http://www.scala-lang.org/sites/default/files/contributor_agreement.pdf

It should be on file as David Copeland. Let me know if you don't have it.