RndmPrsn11•

Author here. Was excited to see 26 comments, only to find out they're all on whitespace.

Anyway, regardless of your opinions there, ante has many interesting features to offer. Algebraic effects for example are an extremely useful tool from mocking, to State, to implementing Async, Generators, Exceptions, etc. My current plan to monomorphise them takes away most of their runtime cost as well.

54
Ninjaboy42099•

This looks really promising! Keep up the development, it looks incredible :D

15
LEmp_Evrey•

Quick heads-up: There is no such thing as a »UTF-8 scalar value«. There’s a »Unicode scalar value«, which is a 21-bit number with two big holes, not 16-bit as the example suggests.

14
RndmPrsn11•

Ah, looks like you're referring to the comment in the Characters code block. At least the correct terminology was linked above. Good catch though, I'll update the website.

As an aside I've honestly still been wondering if this is the correct representation for a character. It can fit most single character like things but not all. I've heard people preach Swift's handling of characters before where a character can be arbitrary length, but it's still something I need to investigate further.

6
Noria7•

I love the way Swift handles UTF-8 Strings. It's performant and ergonomic. The only drawback is that it takes O(n) to randomly access an element but that's rarely needed in practical every day programming. Here's a blog about it.

8
masklinn•

The only drawback is that it takes O(n) to randomly access an element

If you access them by non-code-unit, but that should rarely be needed: normally you’d access an index you’d obtained previously, and that can be an opaque code-unit index.

It’s also possible to build indexes into UTF8 streams, that’s what Pypy does to provide ~O(1) access to codepoints despite using a UTF8 internal string encoding.

2
LEmp_Evrey•
  • A »character« is what Unicode calls a Scalar Value.
  • Then there are Extended Grapheme Clusters, which Swift has built-in. EGCs consist of one or more Scalar Values that compose into a single glyph when rendered.
  • Text is a sequence of one or more EGCs.

That’s pretty much the simplified gist of it. There’s way more to Unicode than that, like proper word-breaking. And i absolutely urge you to take a long Unicode research detour if you wish for your language to be taken seriously for production in the long run. It’s really hard and messy to fix Unicode handling mistakes later.

2
matthieum•

And i absolutely urge you to take a long Unicode research detour if you wish for your language to be taken seriously for production in the long run. It’s really hard and messy to fix Unicode handling mistakes later.

Which is why my advice is to start with ASCII only.

Yes, it does leave out a large portion of the world, but it allows you to work on the semantics of the language, and push back part of the efforts on the presentation layer.

3
Ok_Conclusion2664•

Missing the forest for the trees is kind of the programmers' credo

9
thelamestofall•

Taking into account some C or Fortran code I've seen I completely understand making indentation mandatory. Python made scientists indent their code properly, for instance, I think most programmers don't realize the miracle of it

(Keeping the tradition: please, drop the carousel, we can't properly scroll the code sample because of it)

6
Godfiend•

This looks super cool and I can't wait to give it a try!

5
uspmm2•

You got my attention with lifetime inference. I'm hopeful in the future there will be languages with the ideas from rust but we don't feel like fighting the compiler

5
ToMyFutureSelves•

What are the main use cases you expect to see the language used for? The first class support for math functions makes me think of academia, though I believe there is already a language commonly used there.

4
RndmPrsn11•

If you're referring to the calculation/Flip example on the home page, that isn't first class at all! Indeed ante doesn't actually have first class for mathematical functions or similar (though it does have purity tracking through effects).

That example was meant to show one fun way effects can be used, though many other, more practical examples exist on the Language page of the website

5
CookieOfFortune•

Everything looks pretty reasonable although using # for indexing may throw me for a loop since basically every other language uses []. It's not that the rationale doesn't make sense, but it may take getting used to.

4
matthieum•

I've seen the case for using () for indexing, because an array is just a function from index to value after all.

It seems strange, at first, when you're used to [], but you get used to it.

1
IceShiver•

Whenever I hear the word low-level, I want to see benchmarks. Especially since now you also mention the performance of effects as well.

Also there is very little of info about the memory allocation parts of the language which you seem to base the "low-level" categorization on. For example you listed some C code which should be equivalent to ante code, but the use of word "allocate" and concept of "memory pools" on stack makes me suspect that there is some extra overhead on basic stack allocations compared to C.

3
takanuva•

Refinement types and algebraic effects are great features for a programming language, congrats!

1
skulgnome•

Significant whitespace

In 2022, this is surprising.

32
IanisVasilev•

I never understood why would anybody be opposed to it. If you're going to indent the code anyway, why put more braces?

24
Awkward_Tradition•

Personally: no cut-paste issues, automatic code formatting, you can jump between tokens instead of having to trace what level of indentation you're on, and the feeling of writing python is absolutely abysmal compared to writing lisp with tools like lispy or paredit.

56
AyrA_ch•

Don't forget that accidentally (un)indenting a line can have major impacts on your control flow.

40

Counterpoint: Unindenting a line can have major impacts on readability and debugging when using braces.

-22
Quecksilberbarren•

This

if bla:
    thisIsCorrectlyIndented()
somebodyAccidentallyDeletedThatWhitespace()

is a semantic error.

This

if bla:
    thisIsCorrectlyIndented()
indentationDoesntMatterHere()

# somebody accidently deleted an end keyword

is a syntax error.

Stuff like that happens. One of those is significantly easier to find than the other.

24
prescod•

How many times did this actually happen to you while programming in an indentation-specific language? Because I've been programming in Python for 20 years and don't remember a bug like this.

12
Sparkybear•

You have never had a case where you forgot to indent, or accidentally removed an indent?

2
Quecksilberbarren•

Couple of times with another language but with stuff like removing overloaded parameters instead. But with the quality of window managers deteriorating noticeably on most platforms I expect that number to rise.

-6
IanisVasilev•

I configure my editor to show spaces/tabs (like this). I never really had a problem writing Python even without this feature. Indenting is easy in any modern editor.

-10
Quecksilberbarren•

That won't prevent issues like this.

Imagine you had multiple windows open. Maybe you'd already finished working on some code and then do things in a ticket system. Maybe you'd hit delete and wonder why nothing happens. Maybe because your window manager messed up your focus, because an message popped up, before you could enter text. So you think that you lost your focus, got your ticket system back in focus and after doing whatever else you go back to your editor and save and close without looking at your current line.

That's only one scenario. Maybe somebody else did it. Maybe some tool did mess up whitespace.

11
skulgnome•

Indentation, like symbol naming and comments, is a matter of styling. This is thought best kept separate from language semantics.

9
Full-Spectral•

That's no different to me than arguing why use static types? You are indicating explicitly what the blocking should be, and that they must be balanced or something is wrong. Anything that makes the code more explicit, to me, is generally a good thing.

6
IanisVasilev•

Static typing is important for a very different reason. Annotating variable types for humans is of course helpful, but there is somethung else. In a Turing-complete dynamically typed language, the only way to verify correctness is to run the program. Types allow us to do some simple yet powerful verifications statically. Ante explores "refinement types", which makes static verification much more powerful.

9
Caesim•

I thought so too. But writing eith braces may be pretty simple, then the IDE may just fix up any ambiguities, while indentation being significant is just fixed. Also, when some whitespace accidentally gets deleted, control flow becomes weird. Something that should be in an if, or in a for, is suddenly out of it.

Also, it can be pretty bad and annoying with tabs vs spaces.

2
matthieum•

If you're going to indent the code anyway, why put more braces?

Redundancy.

Most mainstream languages today have fairly horrid parser recovery in the presence of an un-closed, ill-closed, or double-closed block. Good recovery, as rustc does for Rust, pretty much means counting on the fact that the code is well indented to find the spot where a brace is missing, erroneous, or superfluous. If the compiler requires leaning on indentation to recover from brace mistakes, might as well make correct indentation mandatory anyway.

And of course, the opposite is true. Purely using indentation means that it's easy to accidentally put code at the wrong level (especially when the language has statements). Once again, braces allow recovering from the mistake.

I advocate for using both :)

1
glacialthinker•

Then make the whitespace actually significant by encoding it with a specific character which can be interpreted as an indent-level rather than "whitespace".

-6
AyrA_ch•

So, braces?

14

Tab character, of course!

Debate: go!

2
glacialthinker•

Sure! Or any character which might not be interpreted as whitespace and potentially removed, coalesced, or transformed. Then editors could be set up to interpret it as indent-level, offering a nice view. catting wouldn't look good though.

1
thelamestofall•

I mean, Python made non-programmers (like scientists) actually indent their code which believe me, was a big achievement all by itself.

18
skulgnome•

Having seen the outright abortions that EEs crank out for their ard'weeners, I can agree up to a point. However, that point lies slightly before where Python is an interpreted language with automatic memory management, soft types, unstandardized semantics, and surprising behind-your-back behaviour.

3
FrancisStokes•

Python is wildly successful, why not others?

5†
Dealiner•

The question is: is Python popular thanks to significant whitespaces or despite them?

20
FrancisStokes•

Python is successful for a lot of reasons. For some people, the whitespace aesthetic is intuitive and appealing (especially those who experience it as a first language).

13
Quecksilberbarren•

Others didn't have their key moment with Perl as the only competitor.

7
prescod•

Python was from 1991, Lua from 1993 and Ruby from 1995. SmallTalk and many Lisps also existed. Oh yeah and Tcl.

And REXX is older than all of them. And BASIC of course.

1
Quecksilberbarren•

So let's check. From those you mentioned the only one that has the same use case, isn't just as bad as Perl and was relevant at that point is Ruby.

Its initial implementation was too slow. That combined with the fact that its users pretended even more that it is somehow fit to implement actual applications in. It was like people implementing enterprise software in bash scripts.

But Perl is the thing that showed what is important: To look superficially nice.

3
masklinn•

Also, haskell, since this is a functional language whose syntax is quite flagrantly inspired by Haskell’s.

7
skulgnome•

Python is successful like Visual Basic once was: by being taught to students all the way to those entering clerical careers.

4
Torniojaws•

It's a similar Holy War as tab vs. spaces and 2 spaces vs 4 spaces :D

2†
InfeStationAgent•

##IT'S ONLY A HOLY WAR BECAUSE THE OTHER SIDE IS WRONG!

^/s

6
prescod•

How is that surprising???

One of the top and fastest growing languages uses it!

2
McGeekin•

Meh. F# has two syntax modes, one where blocks are delimited by keywords and one where whitespace is significant and the latter leads to much cleaner looking code. I don't see this as that big of an issue.

1
PersismOP•

I just spotted this today. Looks interesting.

11
knome•

I can't copy past from the stupid sideways carousel. Fuck modern web design. It's always just the dev breaking shit that worked 20 years ago.

6
thelamestofall•

I'm generally quite tolerant of these things, but I have to agree, it works so, so bad in mobile. Accidentally selected a text and took me a long time to dismiss the tooltip

6