4 ms·
The syntax just doesn’t sit right with me due to some reason. It gives me the same heebie jeebies as Python’s decorators. Not a fan of either. Maybe I need to g
by rochak 2y ago
The syntax just doesn’t sit right with me due to some reason. It gives me the same heebie jeebies as Python’s decorators. Not a fan of either. Maybe I need to get used to them.
- Hendrikto 2y agoI think Python iterators are designed very cleanly. They just take the function they decorate, and return another. It does not get simpler yet more flexible than this.
- foldr 2y agoThere isn't any new syntax here.
- tapirl 2y ago`range aFunction` is kinda of new syntax, though I agree it is more a new semantic thing.
- pansa2 2y agoDefining a Go iterator is similar to defining a Python decorator that takes an argument. Both involve defining a function that returns another function, with the inner function having another function as its parameter. This isn’t a particularly difficult concept, but manipulating functions in this way does feel unusual in such heavily-procedural languages. This has two downsides: * Programmers who only use those languages are unfamiliar with the concept, and * The languages’ syntaxes aren’t designed to make it particularly clear.