Live data from Hacker News

Ante: A low-level functional language

antelang.org

71–80 of 226 posts

Re: Ante: A low-level functional language

#71

Why, why, why with the significant whitespace? That makes it a non-starter for me.

Age of "var, val" is over. Now age of "significant whitespace". If seriously, seems like indent syntax is default to go nowadays. Python has way too big influence on language designers.

Re: Ante: A low-level functional language

#72
post #48

Earlier quoted context omitted.

> f x -- too mathematical! :) yet we are very happy to use the same syntax in shell scripts or the shell itself.

I guess the difference is that nesting calls (commands) is much less common in the shell, and (closely related) commands don’t really have a return value.

is it? In practice I find that my shell one liners are orders of magnitude more complex than what I would dare to write in any other 'proper' language:

   grep "hello ($(cat patterns.txt| tr '\n' '|'|grep ')$^)"  (grep 'a' >As.txt) >(grep 'b' > Bs.txt)
[yes, gratuitous use of cat, sue me]

Re: Ante: A low-level functional language

#73
This is cool! I really like the syntax for algebraic effects, which would be great for mocking. I also like the way that "impls" can be passed either explicitly or implicitly; the lack of global coherence seems like a reasonable tradeoff. Have you thought about using existential types to support dynamic dispatch (like Rust's "trait objects")?

That said, I'm a bit skeptical of the utility of refinement types (and dependent types in general). They greatly increase a language's complexity (by obscuring the type/value distinction and making type inference and checking more complicated). I'm not sure the benefits are worth it, particularly because of the so-called "specification problem."

Re: Ante: A low-level functional language

#74

Looks interesting. How are closures implemented? Is it possible to use Ante without heap? Are function arguments passed by value?

Hello, author here! Closures are implemented with the environment parameter as an extra parameter on a function type. So internally a function `i32 - i32 -> i32` (wonky function type syntax currently with - separating arguments) which uses an environment of type String is represented as a pair of the function and its environment: `(i32 - i32 - String -> i32), String`. The same way C++ and Rust represent their closures.

Function arguments are passed by value currently, though I may explore pass by move and other options in the future.

I hope for ante to be usable without a heap, though the `ref` type automatically handling lifetimes makes this more difficult. These refs compile to an equivalent of destination-passing in C, but can require dynamic allocation if a function creates a ref and another function calls the first in a loop. I also plan on having an Allocate effect for whenever a function can allocate, so that it is trivial to handle this with your own handle that can do anything. This would be an easier alternative to zig's approach of "pass the allocator everywhere manually," but there are still things I need to iron out, like how it interacts with the lifetime inference issues above, so its still in the design phase.

Re: Ante: A low-level functional language

#75

RE lifetime inference: how does it infer lifetimes for mutually recursive functions that return refs to what would be local data? Does it automatically infer a dynamic stack?

Lifetime inference compiles to destination passing so for most cases a single stack allocation in a prior function can be used. For your example of mutually recursive functions allocating in a loop the destination would be a region that will grow dynamically like an arena allocator. Since refs are typed, ref elements of the same type will be allocated next to each other in memory.

You don't touch on it, but there are some more difficult cases with lifetime inference as well. Namely branching the compiler must decide whether or not to extend a refs lifetime. This and a lack of granularity in container types are known problems with region inference (they lead to more memory than necessary being used by assuming the longest lifetimes), and are things I hope to tackle.

Re: Ante: A low-level functional language

#77

Why, why, why with the significant whitespace? That makes it a non-starter for me.

Age of "var, val" is over. Now age of "significant whitespace". If seriously, seems like indent syntax is default to go nowadays. Python has way too big influence on language designers.

I'm not a fan of python (it handles significant whitespace somewhat poorly). Cases like mixed tab-space whitespace and single-line only lambdas are python-specific problems for example.

I chose it mainly because I like the style and I haven't found it to be an issue in practice yet, especially with flexible rules for line continuations. The biggest detriment to me is the lack of auto-formatters for indentation.

Edit: I'll add to this a point I haven't seen discussed before about functional languages using the `f a b` syntax specifically. Without significant whitespace you cannot really have semicolon ellision with this syntax since almost any line may be interpreted as a function application of the next line. E.g. `a = b + c` and `foo 32` as subsequent lines would be interpreted as `a = b + (c foo 32)`, hence why ocaml requires semicolons. For some people semicolons are fine, but they're just noise to me :)

There's more detail on the specific significant whitespace scheme used on the website here: https://antelang.org/docs/language/#significant-whitespace

Re: Ante: A low-level functional language

#78

Note to the website authors: the carousel with examples is not usable on mobile - trying to scroll the code swipes away to the next item. Would be better as just a series of example blocks.

Carousels should simply be abolished. Just have paragraphs of text/image, one after the other.

Also, black text on white background is easier to read.

And don't make your web design to complex for Firefox reader mode to work: if you do, that's a sign you're doing it wrong.

Re: Ante: A low-level functional language

#79

Why, why, why with the significant whitespace? That makes it a non-starter for me.

Age of "var, val" is over. Now age of "significant whitespace". If seriously, seems like indent syntax is default to go nowadays. Python has way too big influence on language designers.

That and Haskell.

Re: Ante: A low-level functional language

#80

Note to the website authors: the carousel with examples is not usable on mobile - trying to scroll the code swipes away to the next item. Would be better as just a series of example blocks.

Ah, yes. The carousel has been a source of frustration especially on mobile for designing the website. Perhaps disabling swiping to scroll on the carousel on mobile would help. Or defaulting to use a dropdown to select the example on mobile instead.
Post reply on HN