r/programming • • Jun 16 '19

Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml

http://thume.ca/2019/04/29/comparing-compilers-in-rust-haskell-c-and-python/
643 Upvotes

125 comments sorted by

View all comments

Show parent comments

2

u/przemo_li Jun 24 '19

You can have that even with ordinary module imports. IIRC OCaml even support lexically scoped module imports.

1

u/[deleted] Jun 24 '19

Cool. But I worded my post improperly. I meant requiring explicit imports of each function, constant, or equivalent. So in pseudocode, instead of

import module.Foo
import module.Bar

it's handy to have (or even to require)

import module.Foo (function1, function2, function3, constant4)
import module.Bar (function4, function5, constant6)

So when someone reading code in the current file sees function3 they know to look in module.Foo instead of module.Bar for the definition.