Live data from Hacker News

Flix – A powerful effect-oriented programming language

flix.dev

181–190 of 197 posts

Re: Flix – A powerful effect-oriented programming language

#181

Earlier quoted context omitted.

I fully agree with you here. I primarily write JVM applications these days, and my go-to is Kotlin. Not because I think it's the "best" JVM language -- quite the opposite, I think Scala 3 is potentially the best-designed pragmatically useable language at the moment. But Scala 3 gives you "too much rope to hang yourself with". If you're the only person touching a codebase that's fine, but if you have to work with othe…

> But Scala 3 gives you "too much rope to hang yourself with". No, you use it wrong way. It gives you capability to write cleanest code possible. As with any expressive language you have to select a subset of features and a specific style and maintain it. Unmaintainable code can be written in any language, expressive ones provide you with tools to keep code maintainable. HKTs and macros make possible things which are…

that's a cool story for 1 person projects that use no libraries.

also, no working on other people projects.

which is fine. i do clojure, i stay in my niche!

Re: Flix – A powerful effect-oriented programming language

#182

love the syntax, and excited to mess with it, but man i’m sad to see it’s on the JVM. if i had to guess, a lot of langs like this are on JVM because that’s a lot simpler than writing a whole backend with anywhere near the same performance or reliability, and i totally get that. that being said, bearing in mind that i’m not a Java/JVM developer and only rarely have to use it, for the few nontrivial projects i have shi…

there's no such thing as generic "jvm builds" as far as i understand though. jvm is the target, it's like saying x64 builds are complex. maybe you re thinking of ant or maven or gradle? there are plenty others.

you can build basic java with "javac myfile.java". done.

each jvm language has its own build tools and some build tools cover jvm languages in between others.

Re: Flix – A powerful effect-oriented programming language

#183

Earlier quoted context omitted.

> But Scala 3 gives you "too much rope to hang yourself with". No, you use it wrong way. It gives you capability to write cleanest code possible. As with any expressive language you have to select a subset of features and a specific style and maintain it. Unmaintainable code can be written in any language, expressive ones provide you with tools to keep code maintainable. HKTs and macros make possible things which are…

I don't have the mental energy to review every line of code and argue with co-workers that they're "using it the wrong way" unfortunately. Maybe in my younger years, but not after the first decade... This is why Rob Pike designed Go the way he did, I think.

> I don't have the mental energy to review every line of code and argue

You don't have to. Just your process is broken.

> first decade

I've been using Scala since 2008. I'm not a smart guy, so made some smart tools which do the enforcement job for me.

Re: Flix – A powerful effect-oriented programming language

#184

Earlier quoted context omitted.

> But Scala 3 gives you "too much rope to hang yourself with". No, you use it wrong way. It gives you capability to write cleanest code possible. As with any expressive language you have to select a subset of features and a specific style and maintain it. Unmaintainable code can be written in any language, expressive ones provide you with tools to keep code maintainable. HKTs and macros make possible things which are…

that's a cool story for 1 person projects that use no libraries. also, no working on other people projects. which is fine. i do clojure, i stay in my niche!

Not true, we successfully maintain more than 1 MLoC of Scala code. But our framework is completely homegrown.

> no libraries.

We made the cats->zio adapters and BIO, we do use libraries, in a sense more extensively than other teams out there do.

Re: Flix – A powerful effect-oriented programming language

#185
post #98

Earlier quoted context omitted.

The logic programming / datalog feels a bit gimmicky on top of everything else. All the other features, I can see exactly how they'd improve the type soundedness of a codebase. But logic programming is really niche and I'd almost rather it be independent of the language.

The counter-point is the following: Functional programming is great for working with lists and trees. But functional programming (and imperative programming) struggle with succinctly, correctly, and efficiently expressing queries on graphs. Datalog, on the other hand, is excellent for working with graphs. It is simple, expressive, and (can be) very fast. It is a power tool. Most of the time it should not be used, but…

But lists and trees aren't really "built into" languages. They're part of the standard library, not the language itself. Maybe one could say "foreach" syntax builds lists into a language, but in many languages you can foreach non-lists, others have foreach as a method instead of syntax, and it still doesn't say anything about trees.

I do see your point, I'm just not so sure I think it'd be the right thing to do. It feels like too big and arbitrary to be a core language feature, better left to a library. If there are some core features that would make building such a library easier, I'd focus on those rather than the logic programming itself. Something like how Rust did async. (Though contrarily, I think Rust should have built async into the language, since it's pervasive and hard to interop different implementations. Unlike async, logic programming is typically self-contained, and there would rarely be a need to interop multiple implementations).

Anyway, great work so far. I look forward to seeing it progress.

Re: Flix – A powerful effect-oriented programming language

#186

Earlier quoted context omitted.

The counter-point is the following: Functional programming is great for working with lists and trees. But functional programming (and imperative programming) struggle with succinctly, correctly, and efficiently expressing queries on graphs. Datalog, on the other hand, is excellent for working with graphs. It is simple, expressive, and (can be) very fast. It is a power tool. Most of the time it should not be used, but…

But lists and trees aren't really "built into" languages. They're part of the standard library, not the language itself. Maybe one could say "foreach" syntax builds lists into a language, but in many languages you can foreach non-lists, others have foreach as a method instead of syntax, and it still doesn't say anything about trees. I do see your point, I'm just not so sure I think it'd be the right thing to do. It f…

Going a little further, what I'd really like to see is the core concepts implemented in a way that allows a standard implementation to follow straightforwardly from the type system, but also allow for doing nonstandard things. Like, "here's a logic language built in" is kind of boring. What's more enticing is "Here are the components. Here's a nominal implementation based on these components. Here's a weird thing you can do that we hadn't actually designed for, but could fit certain use cases."

I remember Jon Skeet did a whole series of blog posts on reimplementing C# async, which was possible because C#'s async syntax isn't bolted to the implementation, and added features like coroutines that weren't part of C# at all. https://codeblog.jonskeet.uk/2011/06/22/eduasync-part-13-fir.... Similarly Daniel Earwicker had a series where he implemented async/await using iterator syntax instead https://smellegantcode.wordpress.com/2010/12/14/unification-....

And sure, now I know it's all kind of fancy but fairly trivial stuff you can do with monads (and I guess free monads in the Linq-to-SQL case), but it was fascinating to me at the time.

So yeah, for "selling" purposes, I think rather than selling datalog built into the language as a front-page feature, a series of "how to build a datalog" posts would go further in showing off the power of the components of the language that it's built from.

(And FWIW I do like the way C# has built-in support for "important" monads like iterators (foreach), generators (yield), async (await), optional (null propagation operators), etc., even though a language purist would argue against it. I think it provides an easier on-ramp for newer developers, and helps make common things more concise and readable. So it'd be interesting to see where that line would best get drawn for logic programming, what gets special-but-extensible syntax support, and what is purely implementation and functions).

Re: Flix – A powerful effect-oriented programming language

#187

If you have an effect ReadsFromDB, you can't enforce statically that someone will not come along and change the ReadsFromDB effect to write to the db. That's why I think Haskell got it right in the first instance, functions are either pure or IO.

What do you mean? In Flix, if a function has "Bool" as a return type then it can only return a Boolean value. That's what a type system ensures. Similarly, in Flix if a function has the "ReadsFromDB" effect then it can call operations that cause "ReadsFromDB"-- but it cannot cause any other effect. In particular, if there is also a "WriteToDb" then it cannot perform that effect. This is not just aspirational. It is a…

But you have user defined effects don't you? E.g say I define an effect ReadsFromDB, it doesn't necessarily do what it says on the tin, and there is no way a compiler can check that it does. It could read from the db, and send some rockets into space. So a consequence of that is that these "effect systems" just amount to giving names to blocks of code. That's not necessarily a bad thing.

Re: Flix – A powerful effect-oriented programming language

#188

Earlier quoted context omitted.

What do you mean? In Flix, if a function has "Bool" as a return type then it can only return a Boolean value. That's what a type system ensures. Similarly, in Flix if a function has the "ReadsFromDB" effect then it can call operations that cause "ReadsFromDB"-- but it cannot cause any other effect. In particular, if there is also a "WriteToDb" then it cannot perform that effect. This is not just aspirational. It is a…

But you have user defined effects don't you? E.g say I define an effect ReadsFromDB, it doesn't necessarily do what it says on the tin, and there is no way a compiler can check that it does. It could read from the db, and send some rockets into space. So a consequence of that is that these "effect systems" just amount to giving names to blocks of code. That's not necessarily a bad thing.

If you define a variable called number_of_apples, there is no way for the compiler to check that it actually contains the number of apples. How is that different?

Re: Flix – A powerful effect-oriented programming language

#189

JVM is a no-starter. The language looks nice tho, shame they built it on JVM.

The JVM is a state-of-the-art virtual machine with multiple open source implementations, a large ecosystem, and a fast JIT compiler that runs on most platforms. It is hard to find another VM with the same feature set and robust tooling.

Im fully aware. But i dont want a heavy and bloated runtime like the JVM. Its slow (startup) and clunky, and has decades of feature creep and bloat.

Re: Flix – A powerful effect-oriented programming language

#190
post #188

Earlier quoted context omitted.

But you have user defined effects don't you? E.g say I define an effect ReadsFromDB, it doesn't necessarily do what it says on the tin, and there is no way a compiler can check that it does. It could read from the db, and send some rockets into space. So a consequence of that is that these "effect systems" just amount to giving names to blocks of code. That's not necessarily a bad thing.

If you define a variable called number_of_apples, there is no way for the compiler to check that it actually contains the number of apples. How is that different?

It's different. Effect systems claim to be a 'major evolution' that 'enforce modularity'. But they don't really enforce anything other than the modularity provided by standard oop classes or if in a fp language, function modules.
Post reply on HN