Hacker News new | ask | show | jobs
by jcelerier 2237 days ago
I am still humbled by your persistence in looking for deep truths in forum comments.

> This implements async await in Haskell via a library using Monads. Hint: you cannot do this in C via any library. You need to modify the language. If you are uneducated about Monads, you might think this is similar to some kind of C code. It is not!

it's still pretty much

> almost C-like syntax once again.

at no moment, not a single time, did I say in any way that I was talking about semantics but this is apparently a hill you wish to die on... so, by all means have fun !

Maybe you'll be more convinced by the exact text of the paper that introduced do-notation though ?

http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.11....

let me quote it :

> Using monads gives functional programming an imperative flavour. Gofer supports a, so called, do notation which makes this imperative flavour more apparent.

or, let me rephrase that whole thing for you in a language that you seem to speak quite fluently:

    class BasicallyC m where
      (>>=)  :: m a -> (  a -> m b) -> m b
      (>>)   :: m a ->  m b         -> m b
      return ::   a                 -> m a
      fail   :: String -> m a

    class BasicallyC m => ImperativeFlavour m
1 comments

You very conveniently skipped that you cant build async /await in C without modifying the language.

You also failed to show how parser combinator grammars such as yacc/bison/BNF forms are basically just imperative code.

Monads model effect systems; not imperative code.

I am impressed by your ability to argue about stuff you know nothing about, and linking to papers and documents you can't even read. Have you considered running for US president?

> You very conveniently skipped that you cant build async /await in C without modifying the language.

but async / await is semantics, not syntax, thus completely irrelevant to the conversation. you want an example of building async / await into the syntax of C as a library ? tada !

    void* async(...) { return NULL; }
    void await(void* ptr) { }

    int main(int argc, char** argv) { 
       void* handle = async(printf("foobar"));
       await(handle);
    }
or maybe you would prefer the more "modern" version, still compatible with pure C89 syntax though ?

    #define async
    #define await (void)

    int main(int argc, char** argv) { 
       auto x = async printf("foobar");

       /* wow, you can even compose it ! */
       auto y = async 2 * x;

       await x;
    }
please go on, this is super entertaining !
Wow man! your async-await code actually does nothing! I don't think I have argued so much and so far with an idiot!