Email or username:

Password:

Forgot your password?
Martijn Faassen

I wonder how to best describe how #RustLang influences design, for better or worse. Here is some rambling...

It makes you avoid cyclical data structures, and you are far more aware of ownership. This makes surprising action at a distance harder. It also makes it more difficult to misuse globals or struct fields as globals just to pass data along to where it is needed no matter how.

Enums turn out to replace dynamic dispatch very often. Inheritance is just gone.

1/n

2 comments
Martijn Faassen

Since dynamic dispatch is uncommon, you might think traits are less common, but they are not, especially default ones. Because they are used to define how generics fit together statically. Generics are interesting as they are highly abstract yet what happens in runtime is very concrete - no action at a distance.

2/n

Esteban K�ber :rust:

@faassen One thing about traits is that it makes thinking about Rust code closer to how I think about relational databases.

I am reminded of

"Show me your flowchart and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won't usually need your flowchart; it'll be obvious." -- Fred Brooks, The Mythical Man Month (1975)

which significantly shaped how I think about problems. Traits + ADTs put you in the same frame of mind.

Go Up