Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Trithon10305y@IntrusionCM a reasonable one?
something like kotlin or go, where functions have easy to write typed and can be passed around like any other variables. python and js are also fine if you don't mind not having type safety -
Is it? I still have to try them, unfortunately I never had to use that feature. I'm really looking forward to it, when the right time arrives. It's something emotional for me, Java and lambdas.
-
@Trithon functional interfaces in java and lambdas implementing them are also typed and can be assigned to variables. And operated on as ones. They can also be serialized, meaning dumped to a file, stored in redis or db, transferred over the network.
What's the problem here? -
@Trithon so basically what you’re saying to @IntrusionCM Is that you don’t like statically typed languages? 😄
I really like the java approach. The py one is really nice as well though..
If you wanna treat everything like any variable, try > java 9.
Haven’t used it myself yet but I don’t like what I’ve read so far. -
I think that code examples would be nice...
It's not that I favor any language, but I think that every feature can be used in good or bad ways.
Using lambdas as variables sounds nice first, but long term... Uh....
Don't think so... It hides complexity -
Really don't get the issue. There's things I wish it supported (currying, operator overloading etc.) but the general approach I find pretty solid tbh. I'd take it over the JS approach any day.
-
"using lambdas as variables"
Hey uh so me and my functional gang are gonna find you and beat you up if you dont mind.
I mean @intrusioncm -
@IntrusionCM You're kind of right, having functions as first class citizens can make things complex — especially if you don't choose good variable names consistently.
But the power it unlocks, and with that, the bugs it can prevent, make it more than worth it.
I would really recommend trying out this course/book in a lost weekend:
http://learnyouahaskell.com/chapter...
Not because everyone should program in Haskell, but because it opens your eyes to functional patterns, and why OOP languages are rapidly adopting Haskell-like features. -
@bittersweet again... You didn't read the comments, too...
I said that storing an lambda inside a variable is a bad idea longterm wise....
What the fuck? -
@IntrusionCM i have read it. Ive seen that you think "storing a lambda in a variable" is uh... a thing. Its a first class function. What do you think is the difference between
def fun(){ // }
and
let fun = () => //
is?
Absolutely nothing* -
@larrywho11 you have a type that accepts arguments and produces a value. Thats called a function. But i guess i should totally listen to devrant user larrywho11 instead of oracel.
-
@larrywho11 you are either a troll or another college dude whos only experience is writing that hangman assignment in java6, and im leaning towards the second.
Btw the method-container-object you are talking about is called a monad. -
@yellow-dog don't know much about functional programming. But as far as I remember there is no function in java either
-
Java was designed for OOP so its natural that functional paradigm is kinda hacky. Lambda is not the most intuitive way but its the Java way. I do not like Java or any OOP focused language by that matter, but @yellow-dog has a point i do agree.
-
Trithon10305y@just8littleBit ah yes, the not statically typed languages like kotlin and go!
-.\
What i hate is how java ""solves"" the issue. It's so perfectly not clear.
Reasonable language:
sort( array: type[], isBigger: (type, type): bool ) {•••}
Java:
sort( type[] array: Predicate<type, type> bool ) {•••}
To someone a bit unfamiliar with functional style, the java way is much too complicated!
What the fuck is a predicate? It's a grammatical component you fucks! Not a function that takes some generic ass arguments and returns a bool!
What the hell is a DoubleConsumer<T, S>??
Oh you want a DoubleIntFunction<T, S> as well? Too bad, stdlib only has 3-param long types prepared for ya!
And i don't even know any other types that might exist like that! Why not make it easy and make the type the signature w/o the name!!!
Java could style it like:
type name( argtype name, rettype(argtype, ...) name2 ) {•••}
Would be much easier to learn and understand! -
@Trithon did you know, that in scala, you can literally pass "predicate", and it will resolve to a (a: Any, b: Any): Boolean ?
Related Rants
man... fuck java's approach to lambda expressions and like passing functions as arguments and the lot.
it's honestly just so terribly bad. it's sucks so much.
rant
function
lambda
functional programming
java
lambda expression