6 ms·
I've written a few small Julia programs and have found it to be a very productive language, in most respects. Unfortunately its module system is horrid. If you
by transfire 12y ago
I've written a few small Julia programs and have found it to be a very productive language, in most respects. Unfortunately its module system is horrid. If you look at almost all Julia programs, they are essentially one big file. Any secondary files just get included into a main file wholeclothe. It's like working with archaic PHP all over again.
- cschmidt 12y agoDon't people used Module in practice? http://julia.readthedocs.org/en/latest/manual/modules/?highlight=module http://julia.readthedocs.org/en/latest/manual/modules/?highl... I haven't read up on Julia yet, so I'm curious.
- sgt101 12y agoI've only played, but a few hours into it I wanted to partition up my project into separate places in order to separate concerns . I found modules to be a good way to do that once I realised that it's Pascal/modular 2 / ada again and not objects. I think that the problem may be that people are tripped up by the separation of type and modularity when they are used to that being coupled in c++ and java.
- Fede_V 12y agoI agree with this. I think in large part this is because the developers decided to try as much as possible to 'decouple' the concept of module from the filesystem. I think this is clever in the abstract, but in practice, it's a lot of headache for very, very little gain and a lot of added confusion. The main Julia team is a bunch of incredibly smart and dedicated guys who know a lot more about designing language than I do, but I think this was a case of trying to be too clever for your own good.
- CyberDildonics 12y agoSo what are the module systems you like and what do you like about them?
- Fede_V 12y agoI really like Python - I think forcing people into using a certain directory structure is nice, and it makes browsing code easy. I think it's largely a matter of taste though! I just think that having a directory layout that reflects the code structure makes it easy to browse things at a glance, provided there's not too much magic in the __init__ files.
- StefanKarpinski 12y agoThat structure makes sense in class-based single-dispatch o.o. languages like Python and Java. It does not make sense in a classless multiple dispatch language like Julia.
- sgt101 12y agoHangon - I thought a module was a separate namespace; and a way of partitioning programs into files. Can you be more specific in your criticisms?
- rspeer 12y agoYou and I might expect a module to be both of those things, probably based on experience with languages such as Python. Julia's position so far has been that files and modules are entirely unrelated to one another. Modules are namespaces, and files are messy things on a disk. Hooray! You can organize your code however you want! The problem is that I don't want to decide how to organize my code. I want to write the code to some best practices that have been thought up by someone who deeply understands their implications. Julia doesn't have these yet. I hope that it does one day.
- msravi 12y agoThe application I work on is fairly complex and I've had no trouble at all building and organizing my code into separate modules.
- tlmr 12y agoIs this going to hamper it from being the next python for both general and data science programming? Do you think I should invest in learning julia, or continue with python?
- johnmyleswhite 12y agoI often say this, but I think if you have doubts about whether you should learn Julia or Python, then you should certainly learn Python.
- one-more-minute 12y agoPersonally I really like Julia's module system. It's certainly not dogmatic, which (as in any flexible system) means it's easy to write bad code, but there's nothing stopping you from being as organised as you want to be. Then there's the pattern of having a few large modules as opposed to many small ones; I can see how that would seem strange if you're used to a more object-oriented style, but it's pretty common in more functional languages.
- asg 12y agoWell, that is just one way of doing it. As other commenters say below, julia decouples the concepts of namespaces, and files. Which means there are many ways of organising your code. You're right in that most projects include files into one large modules. Not every body like a it, but it does work for many codebases. If you want however, nothing prevents you from having separate modules per files.You could also create hierarchical modules, and store the files in a matching heirarchy of directories. As a young language, some programming patterns are still being experimented on by the purveyors of the language. But I don't think the module system is fundamentally weak in this respect.