tag:blogger.com,1999:blog-36017112.post97679286786736265..comments2024-03-17T16:34:38.393+00:00Comments on Featherweight Musings: Rust for C++ programmers - part 8: destructuringUnknownnoreply@blogger.comBlogger6125tag:blogger.com,1999:blog-36017112.post-9907438010897050072015-03-20T12:21:28.057+00:002015-03-20T12:21:28.057+00:00Your blog is a heaven for those who want to learn ...Your blog is a heaven for those who want to learn <a href="http://cplusplusinurdu.com" rel="nofollow">C++ in Urdu</a><br />Anonymoushttps://www.blogger.com/profile/14237976047302911890noreply@blogger.comtag:blogger.com,1999:blog-36017112.post-34498522308650145202014-08-14T11:17:14.264+01:002014-08-14T11:17:14.264+01:00Thanks for your ideas. You can also find the detai...Thanks for your ideas. You can also find the details on Affity Solutions, at the <a href="http://affitysolutions.com/career.htm" rel="nofollow">C++ Development</a>. The main object of the Affity Solutions is to provide quality web services and is among the few software development company in Nagpur.Anonymoushttps://www.blogger.com/profile/13244324408180386775noreply@blogger.comtag:blogger.com,1999:blog-36017112.post-68691185088846447512014-07-17T02:15:21.982+01:002014-07-17T02:15:21.982+01:00@Peter Hull: partly necessity, unlike C++, Rust ha...@Peter Hull: partly necessity, unlike C++, Rust has many data structures where you can't extract the data with field access - you have to destructure (enums, tuples, etc.). Partly just because destructuring is a somewhat modern construct and wasn't widely thought useful when C++ came about, but is now. Probably lots of other subtle, trade-off reasons too.Nick Cameron.https://www.blogger.com/profile/04760749052780174977noreply@blogger.comtag:blogger.com,1999:blog-36017112.post-4205248420982565482014-07-15T11:49:52.716+01:002014-07-15T11:49:52.716+01:00In other words:
fn foo(b: Big) {
let ...In other words:<br /> fn foo(b: Big) {<br /> let Big { field6, field3, ..} = b;<br /> println!("pulled out {} and {}", field3, field6);<br /> }<br /><br />... you wouldn't write in C++:<br />void foo(Big b) {<br /> int field6 = b.field6;<br /> int field3 = b.field3;<br /> cout << "pulled out " << field3 << " and " << field6 << endl;<br />}Peter Hullhttps://www.blogger.com/profile/17794251492475991671noreply@blogger.comtag:blogger.com,1999:blog-36017112.post-86499279742974188052014-07-15T10:06:01.529+01:002014-07-15T10:06:01.529+01:00This is great, I am enjoying reading these posts, ...This is great, I am enjoying reading these posts, please carry on!<br /><br />Re: destructuring<br />It seems very common in functional languages (e.g. Haskell) but not in C++ (you would just access the member variables of an object). Rust seems to favour the former, do you know why?Peter Hullhttps://www.blogger.com/profile/17794251492475991671noreply@blogger.comtag:blogger.com,1999:blog-36017112.post-11952816503452334682014-07-13T20:42:28.902+01:002014-07-13T20:42:28.902+01:00Good idea to target C++ programmers!Good idea to target C++ programmers!Anonymousnoreply@blogger.com