Hacker News new | ask | show | jobs
by klibertp 2952 days ago
I have a blog post from a few years back with a sample, here: https://klibert.pl/posts/avail-and-articulate-programming.ht...

I'm pasting a link because I added on-hover popups explaining parts of the snippet, but here is the sample itself:

    Module "Hello World"
    Uses
        "Avail"
    Entries
        "Greet Router"
    Body

    Method "Greet Router" is [
        socket ::= a client socket;
        target ::= a socket address from <192, 168, 1, 1> and 80;
        http_request ::= "GET / HTTP/1.1\n\n"→code points;

        Connect socket to target;
        Write http_request to socket;
        resp_bytes ::= read at most 440 bytes from socket;

        Print: "Router says: " ++ resp_bytes→string ++ "\n";
    ];
2 comments

This looks like the result of a drug-and-alcohol-fueled unplanned pregnancy between COBOL and Ada.
Yeah, plus a bit of APL - it's not visible in this snippet, but Avail uses a lot of strange unicode characters/symbols. The `→` in `resp_bytes→string` is one example, but there are many more symbols used: http://www.availlang.org/about-avail/documentation/unicode-c...
If you grab the development branch, you can use the modular lexers to make that a little bit clearer. If memory serves, “a socket address from <192, 168, 1, 1> and 80” can now be written “192.168.1.1:80”. Not because that syntax is designed into the language, but because the language is designed to allow an IPv4 lexer to be defined within the language. See distro/src/avail/Avail.avail/IO.avail/Address.avail:149 for the actual Avail code that lexes (produces tokens from module source) IPv4 addresses.