• kvp
    #2
    A rust az olyan, mint amikor a c-t egy 1970-es evekbeli makro assemblerrel keresztezik. A hasznalatarol valahogy egy rozsdas sajtreszelo jut eszembe.

    Ettol fuggetlenul elvileg biztonsagosabb nyelv mint a c, ellenben statikus, igy elvileg gyorsabb mint a nativ kodra forditott java. A belinkelt irasban olyanokrol irnak, hogy egy c++-os stringet nem igazan lehet elerni nativ modon rust alol, de egy c++-os string-et tartalmazo strukturat meg annyir sem. Na most a legtobb rendszer szintu api es kulso programkonyvtar az vagy c vagy c++ strukturakat hasznal. A rust direkt ugy lett megirva, hogy ezeket a feluleteket fajdalmasan nehez legyen biztonsagos (szabalyos) modon elerni.

    "We think the hardest part of this is imagining a safe way to pass types between Rust and C++. That requires auto-generated shim code on both the Rust and C++ side. That’s already achieved by cxx with terrific emergent safety properties. And so that’s our basic model.
    But, we don’t want to specify a cxx::bridge section for every API. We therefore need the cxx::bridge to be generated using a bindgen-like tool.
    We don’t believe Rust language changes are needed. Some C++ types can’t be owned by value in Rust — for example std::string with its self-referential pointer — but we believe that good C++ interoperability can be achieved even if Rust can only own such objects by pointer. We may be wrong here as well!"

    Tehat vagy generalnak egy rakat folosleges kodot, ami oda-vissza konvertalja az adatokat vagy meg egy string-et (sima szoveget) tartalmazo valtozot sem fognak tudni elerni. Egy jo programnyelvnek nem kell generalt kod ahhoz, hogy egy olyan alap funkciot elerjen, ami mar 40 eve a Commodore-ok idejen is magatol ertetodo volt. Ertem, hogy biztonsagos, csak nekem tovabbra is egy nagyon biztonsagosra tervezett rozsdas sajtreszelonek tunik. Ehhez kepest meg az Ada is egy felhasznalobarat nyelv.