4 ms·
Too many dots. It feels like programming in a OOP language, which C isn't.
by wheelerof4te 4y ago
Too many dots. It feels like programming in a OOP language, which C isn't.
- flohofwoe 4y agoUFCS is hardly "OOP", it's just a bit of syntax sugar to allow function call chaining instead of nesting.
- tmtvl 4y agoBut isn't function call chaining generally an antipattern? And you can do it without Universal Function Call Syntax anyway, and besides... it's ugly as hell. # Writing it like this is bad: print (length (drop_failed (get_students (school_system)))); # But like this is okay? school_system.get_students().drop_failed().length().print();
- wheelerof4te 4y agoThat makes it seem like every function call returns an object, that calls it's own method. Weird.
- tmtvl 4y agoThat is Uniform Function Call Syntax, cfr. Wikipedia: https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax https://en.wikipedia.org/wiki/Uniform_Function_Call_Syntax
- flohofwoe 4y agoPersonally I find the chaining a lot more readable, but maybe that's just me :)
- naasking 4y agoIt's not just you. Long function chains/nested function calls are discouraged in most languages for readability reasons, but chaining is 100% more readable to everyone who has tried both for any appreciable length of time.
- kristoff_it 4y agoChaining this much is not really recommended in Zig. An idiomatic implementation of that stuff would not allow you to chain this much. Additionally, in Zig temporaries (which you would be implicitly constructing by chaining) are immutable, meaning that a chain of calls would only compile as long as it doesn't try to mutate any intermediate value (which is a nice protection against footguns). But really, this is a coding style that's considered fine in Rust, not in Zig.
- wheelerof4te 4y agoSo, instead of doing functions like every other modern language in history, you intentonally introduce foreign syntax? And still compare it to C?