4 ms·
Dot syntax is used when accessing a function/property on a value, :: is used when accessing a function/property on a module or type. I think it's great having t
by brundolf 5y ago
Dot syntax is used when accessing a function/property on a value, :: is used when accessing a function/property on a module or type. I think it's great having this visual distinction, especially given that you can call the same function in either style:
let x = Foo::new();
x.bar();
Foo::bar(x);
- Jare 5y agoI thought the distinction was meaningful until I worked in a language that used dot pervasively, and saw that it was totally fine.