epi-project / brane-documentation

Repository that contains the high-level documentation of the Brane framework. Written for use with mdBook.
Apache License 2.0
2 stars 2 forks source link

Syntax: Parallel statements vs expressions. #30

Open DanielVoogsgerd opened 1 month ago

DanielVoogsgerd commented 1 month ago

Currently, in Branescript syntax. Parallel blocks are statements not expressions, with a special syntax to allow assignment. How is this implemented in practice? It seems like these parallel statements really want to be parallel expressions.

Which would allow them in places like function arguments or return values.

I am not suggesting actually altering the current usage of Branescript as that would be too much work. But if this is supported in our implementation already, I think changing these to be expressions would make more sense.

Lut99 commented 4 weeks ago

Ah yes xD the question of the ages. I'm always wondering about that myself, because my predecessor knew Rust and how elegant it is to make everything expressions. But it isn't... it's indeed a special kind of statement.

Once upon a time I started a rewrite of the compiler where I do all the nice things like proper if/else chains, everything being expressions, attributes... but I removed that branch recently as it was only there like 20% of the way, and it relied on horribly outdated code. In the end, only the last one (attributes) really made it to the actual project; the rest's forever a TODO.

Please add it to the future work-section of the BraneScript docs, though! It's good to keep track of these ideas.