Hacker News new | ask | show | jobs
by pantaloons 4787 days ago
For one, you're criticizing a web API here and not the C# language-- and you've failed to even do that convincingly since it's an intentionally verbose example using an outdated API.

res.Text = (await new HtppClient().GetStringAsync(url.Text)).Length.ToString();

(Disclaimer: I work at MS.)

1 comments

Well, that's not bad, but I think the CoffeeScript is better

    $.get $('#url').val(), (res) -> $('#res').val res.length
Or using LiveScript backcalls is even cooler:

    data <-! $.get '/x.html'
    $ \.res .val data
Or in IcedCoffeeScript if you like 'await'

    await $.get 'documentation/css/docs.css', defer res
    console.log res
Or check out the huge list of languages that compile to JavaScript at http://altjs.org/