3 ms·
> It's mostly an imperative language at the language level, but it has so much functional programming stuff in templates that it looks like a functional one.
by Manishearth 10y ago
> It's mostly an imperative language at the language level, but it has so much functional programming stuff in templates that it looks like a functional one.
Not everything can be neatly boxed in "imperative" and "functional". It's a language without purity, but with many other concepts that make a functional style work very well with it. Swift is similar. IIRC so is Scala. Depending on your POV you may classify this as functional or not; folks ascribe different meaning to the terminology here.
> Did that ".collect" generate a big intermediate array? How can you tell without looking at the generated code?
I don't understand this logic at all. How is this different from any function call in C? You don't know what that function call does without looking at the code or documentation.
This is no different from asking whether operator<< on cout allocates.
> and TOML files
This is like make/cmake/ninja files for C. Those are worse, especially since each codebase does its own thing.
> required directory structure.
no. You can set it up how you like, there's a default directory structure that's easier to use. You can redirect modules to whatever path you want using `#[path]`
> Adding a module seems to require editing about three files.
Two files.
In C you have a header and c file anyway, so the totals match up.
I agree that the module system itself is a bit confusing -- we need to get better at teaching it, but you're being rather inaccurate here overall.