Hi,
as any one encounter this type of class def and can explain the pattern
Copy code
Class A cosntructor(...) : (String) -> B {
}
r
Ruckus
01/22/2020, 4:49 AM
it's a class that implements the
(String) -> B
interface (you can think of it like
Function<String, B>
from Java).
a
AnnoymousGiraf
01/22/2020, 4:50 AM
What would be a good use case for that? or a pattern ?
r
Ruckus
01/22/2020, 4:58 AM
That's difficult to answer. Basically when you want a function type that has state. Whether that makes much sense is up for debate, but could possibly be necessary to work around libraries/APIs that don't envision your use case.
a
AnnoymousGiraf
01/22/2020, 4:59 AM
Cheers will have a look into it
AnnoymousGiraf
01/22/2020, 5:05 AM
OK, i looked on the Function interface it is indeed in order to force apply impel. probably sort of Command Pattern