4 ms·
Seriously? Your two examples make the counterpoint to your argument. The first example in Python would be some variant of @get('/') def whatever():
by gecko 13y ago
Seriously? Your two examples make the counterpoint to your argument.
The first example in Python would be some variant of
@get('/')
def whatever():
return "Hello World!"
Or in Ruby:
get "/" do
"Hello World!"
end
Or in Go:
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello World!")
})
These other languages, all popular on HN, are nearly identical to the C#, or even longer in a couple of cases. You'd have to go with a project-specific macro package on a Lisp to get much terser.
The second C# is also quite terse, IMHO. What would you have preferred? The equivalent Python would be something like
__all__ = ['SampleModule']
class SampleModule(nancy.NancyModule):
pass
which, even if you want to say well, no one in real life uses __all__ (which isn't correct) is still nearly the same length. I don't quite remember the Ruby off the top of my head, but it, too, is similar, as would be Perl.
Older C# versions could be verbose, but this seems quite terse to me.