On 13/12/2013 12:53, spir wrote:
I think this is a good possibility, make the module/crate organisation mirror the filesystem (or the opposite):
* 1 module = 1 file of code
* 1 package = 1 dir
This may be limiting at times, possibility one may want multi-module files and multi-file modules.
Yes, one may indeed want those things. In particular, *I* want multi-module files.

I do not want to move towards a Java-style approach where the package nesting structure needs to match the file/directory nesting structure. Being able to declare nested modules within a file is very useful for flexible namespace control.

I like our current support for nesting modules in files, and breaking them out into separate files as one wants.

But then again, I also think that the current approach of { `extern mod`... `use`... `mod`... } is pretty understandable once you, well, understand it. My main complaint has been about the slightly context-dependent interpretation of paths [1], but that's pretty minor. So perhaps I have the wrong point-of-view for interpreting these suggestions for change.

Cheers,
-Felix

[1] https://github.com/mozilla/rust/issues/10910

On 13/12/2013 12:53, spir wrote:
On 12/13/2013 11:43 AM, Diggory Hardy wrote:
What would you do?

Have no structure (no mod)? Or automatically create it from the file structure?

I think this is a good possibility, make the module/crate organisation mirror the filesystem (or the opposite):
* 1 module = 1 file of code
* 1 package = 1 dir
This may be limiting at times, possibility one may want multi-module files and multi-file modules. But this forms a good, simple base (anyway, we have mini & maxi modules & code files, whatever the logical & physical organisations). Another point is that very often we have package (I mean crate ;-) sub-dirs which are not packages themselves. Then, as usual, we'd have a special code file representing a package at its top dir (the same name as the package, or a magic name like 'main').

Then, module sharing is code file sharing, and package management is dir management (trivially .zip-ed or .tar.gz-ed, and then the name "package" is here for something).

Denis
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev


--
irc: pnkfelix on irc.mozilla.org
email: {fklock, pnkfelix}@mozilla.com

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to