> On Sep 19, 2018, at 9:58 AM, Remi Forax <fo...@univ-mlv.fr> wrote:
> 
> Hi Jim,
> the signature of transform() in the webrev was not updated (so the wildcards 
> are missing).

Apologies.  I created the webrev before I fully saved. Will update in a bit.


> 
> And i'm still not convince this method should be introduced as is:
> - it need more variants (transformToInt, transformToLong, transformToDouble) 
> to be useful, currently "foo".transform(String::length) do box the resulting 
> int to an Integer.
> - pull it's own weight, while it's nice to be able to be able to write code 
> fluently from left to right, "foo".transform(Utils::capitalizeFirstLetter), 
> you can say exactly the same thing for all classes in the JDK, e.g. 
> path.transform(Utils.appendTextSuffix). Other languages have introduced an 
> operator to solve that issue (function call syntax is not fluent) like by 
> example the operator '|>' as in "foo" |> Utils.capitalizeFirstLetter.
> 

I hear you. Wouldn’t it be nice to have an Object::transform. Won't happen 
since it would likely break the world. You could push for something |> 
method(…) which applies static R method(T fakeThis, …), but that will take 
years of debate.  String::transform was intended to facilitate custom 
manipulation (alignment) of raw string literals, in the most string generalized 
way. I’ll  discuss the other variants but please provide better use cases.

Cheers,

— Jim




> regards,
> Rémi
> 
> ----- Mail original -----
>> De: "Jim Laskey" <james.las...@oracle.com>
>> À: "core-libs-dev" <core-libs-dev@openjdk.java.net>
>> Envoyé: Mardi 18 Septembre 2018 19:52:17
>> Objet: RFR - JDK-8203442 String::transform (Code Review)
> 
>> Please review the code for String::transform. The goal is to provide a String
>> instance method to allow function application of custom transformations 
>> applied
>> to an instance of String.
>> 
>> webrev: http://cr.openjdk.java.net/~jlaskey/8203442/webrev/index.html
>> jbs: https://bugs.openjdk.java.net/browse/JDK-8203442
>> csr: https://bugs.openjdk.java.net/browse/JDK-8203703
>> 
>> Cheers,
>> 
>> — Jim

Reply via email to