u/Single-Blackberry866

Rust: identity and meaning

Still wrapping my head around this strange language.

Is it fair to say that rust dissolves meaning and identity? Hear me out.

When you talk about variables, a conventional understanding is "this named thing represents a human-readable alias to a thing stored in memory".

When you talk about types, a conventional understanding is "it represents an object type or primitive type, where primitives have language attached behaviour and sizing, while object types can be extended by a language user".

When you talk about objects, a conventional understanding is "it represents a struct + methods, has instance and expected type"

Rust breaks every assumption:

- variable charges identity during lifetime, as data ownership itself moves: it's not just variable has a new value, referencing the variable without ownership does not have a runtime meaning

- rust does not have conventional object types: it has traits. It feels like interfaces, but without intermediate type: you instantiate directly from struct definition, traits are separate.

- rust does not treat objects as having a type, it treats them as a bag or traits. So if you have not defined "quak" and "meow" combination as a named trait, rust is absolutely fine with it. This is similar to class implementing multiple interfaces, but a different order: multiple interfaces attach to a struct, and there's no way to enforce the combination is coherent.

Sounds like minor difference, but it flips the order of how systems are designed: conventionally, you design what you want the system to do first, and then choose structure to implement it. In Rust, bottom up design prevails.

So, do you think there should be a higher level language on top of Rust that defines meaning, ontology and business rules?

reddit.com
u/Single-Blackberry866 — 3 days ago