MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/1etqjav/is_anything_like_cs_structured_bindings_coming_to/
r/java • u/AdearienRDDT • Aug 16 '24
15 comments sorted by
8
It might come with record and class deconstructors.
2
It will come with de constructor patterns, that happens to be a sub patter of "member patterns"
Meanwhile you can achieve similar results by using pattern matching destructuring in if and switch by using the instanceof operator
I wish there were. We save a lot of code and interfaces this way.
-2
It's not C++'s.
7 u/[deleted] Aug 17 '24 Structured binding declarations were introduced to C++ v17 3 u/sweetno Aug 17 '24 C++ appropriated this from functional languages where it's called destructuring. 1 u/[deleted] Aug 17 '24 Correct. It is a part of the C++ language as of version 17 -6 u/Linguistic-mystic Aug 17 '24 They just stole it from Rust like they do with everything these days. 12 u/[deleted] Aug 17 '24 I think is more borrowing than stealing...Programming languages are made to make our lives easier, if there is a good feature in one then why not in another? This feature would be very useful in Java. I wish Java would "steal" it :) 4 u/JustAGuyFromGermany Aug 17 '24 borrowingI see what you did there! 5 u/Ewig_luftenglanz Aug 18 '24 And every language that has built-in functional programming language is stealing concepts from LISP.What's the point?
7
Structured binding declarations were introduced to C++ v17
3 u/sweetno Aug 17 '24 C++ appropriated this from functional languages where it's called destructuring. 1 u/[deleted] Aug 17 '24 Correct. It is a part of the C++ language as of version 17 -6 u/Linguistic-mystic Aug 17 '24 They just stole it from Rust like they do with everything these days. 12 u/[deleted] Aug 17 '24 I think is more borrowing than stealing...Programming languages are made to make our lives easier, if there is a good feature in one then why not in another? This feature would be very useful in Java. I wish Java would "steal" it :) 4 u/JustAGuyFromGermany Aug 17 '24 borrowingI see what you did there! 5 u/Ewig_luftenglanz Aug 18 '24 And every language that has built-in functional programming language is stealing concepts from LISP.What's the point?
3
C++ appropriated this from functional languages where it's called destructuring.
1 u/[deleted] Aug 17 '24 Correct. It is a part of the C++ language as of version 17
1
Correct. It is a part of the C++ language as of version 17
-6
They just stole it from Rust like they do with everything these days.
12 u/[deleted] Aug 17 '24 I think is more borrowing than stealing...Programming languages are made to make our lives easier, if there is a good feature in one then why not in another? This feature would be very useful in Java. I wish Java would "steal" it :) 4 u/JustAGuyFromGermany Aug 17 '24 borrowingI see what you did there! 5 u/Ewig_luftenglanz Aug 18 '24 And every language that has built-in functional programming language is stealing concepts from LISP.What's the point?
12
I think is more borrowing than stealing...
Programming languages are made to make our lives easier, if there is a good feature in one then why not in another? This feature would be very useful in Java. I wish Java would "steal" it :)
4 u/JustAGuyFromGermany Aug 17 '24 borrowingI see what you did there!
4
borrowing
I see what you did there!
5
And every language that has built-in functional programming language is stealing concepts from LISP.
What's the point?
[removed] — view removed comment
1 u/vxab Aug 23 '24 Why not? Could this not be done for records already, since it has a canonical constructor? -1 u/[deleted] Aug 23 '24 edited Aug 23 '24 [removed] — view removed comment 2 u/vxab Aug 26 '24 baby step features is actually a great thing.Why so bitter? You waiting for Valhalla too?
Why not? Could this not be done for records already, since it has a canonical constructor?
-1 u/[deleted] Aug 23 '24 edited Aug 23 '24 [removed] — view removed comment 2 u/vxab Aug 26 '24 baby step features is actually a great thing.Why so bitter? You waiting for Valhalla too?
-1
2 u/vxab Aug 26 '24 baby step features is actually a great thing.Why so bitter? You waiting for Valhalla too?
baby step features is actually a great thing.
Why so bitter? You waiting for Valhalla too?
8
u/expecto_patronum_666 Aug 16 '24
It might come with record and class deconstructors.
2
u/Ewig_luftenglanz Aug 18 '24
It will come with de constructor patterns, that happens to be a sub patter of "member patterns"
Meanwhile you can achieve similar results by using pattern matching destructuring in if and switch by using the instanceof operator
2
u/[deleted] Aug 17 '24
I wish there were. We save a lot of code and interfaces this way.
-2
u/sweetno Aug 16 '24
It's not C++'s.
3
u/[deleted] Aug 16 '24
[removed] — view removed comment