Two small points of feedback

Howard Lovatt howard.lovatt at gmail.com
Fri Jan 4 13:31:26 PST 2013


Re naming convention

In my own libraries I consistently use name[Types], which mimics the base generic declaration e.g.:

Callable2<I1, I2, O> { O call(I1 i1, I2 i2); }
Callable2TTL<I1, I2> extends Callable2<I1, I2, Long> { 
  default Long call(I1 i1, I2 i2) { return callTTL(i1, i2); }
  long callTTL(I1 i1, I2 i2);
}
Callable2LLL extends Callable2TTL<Long, Long> { 
  default long callTTL(Long i1, Long i2) { return callLLL(i1, i2); }
  long callLLL(long i1, long i2);
}

Sent from my iPad

On 05/01/2013, at 1:42 AM, Stephen Colebourne <scolebourne at joda.org> wrote:

> In our regular lunchtime meeting at OpenGamma I posed two questions to
> get feedback:
> 
> 1) "What does this code do"
> 
>  range(1, 10).forEach( (i) -> System.out.println(i) );
> 
> First response "if that doesn't print 1 to 10 then someone needs their
> head examining" (someone working in multiple languages more focussed
> on maths than Java coding)
> Second responses "suppose it might depend"/"have to check docs" (Java
> developers)
> 
> Personally, I think that while it can be explained/documented that it
> is a half-open range, it reads far better in code as a closed range.
> 
> 
> 2) "Which of these corresponds to IntFunction"
> 
>  (int) -> T
>  (T) -> int
> 
> Response chose the first (whereas the codebase has the second).
> 
> Personally I would choose the first (and use FuncInt, FunctionInt,
> CalcInt, CalculatorInt or IntCalculator for the second).
> 
> (poll highly unscientific, respondents had limited/no exposure to
> lambdas, yada yada yada)
> Stephen
> 


More information about the lambda-dev mailing list