3 ms·
This is interesting. I find that regexes are one of the few places where a comment explaining what a block of code does is generally necessary. Since the "rub
by fishtoaster 13y ago
This is interesting. I find that regexes are one of the few places where a comment explaining what a block of code does is generally necessary. Since the "ruby way" is to use aggressively replace comments with method and variable names, a tool like this is a good way to achieve that goal.
That said, this also makes a huge tradeoff against conciseness. Personally, I'd prefer
# Is foo a valid klingon email address?
foo =~ /gibberish/
Over
foo = Hexpress.new.
start('g').
maybe('i').
many('b').
find('b').
...
- krainboltgreene 13y agoIn another rant about how my library isn't needed someone helpfully noted you can actually do comments with the %r{} syntax: %r{ ^ # foo bar $ }