HNHacker News
TopNewBestAskShowJobs

jorkadeen

212 karma · joined December 20, 2018

submissionscomments
jorkadeen··on The Flix Programming Language
The Flix compiler is written in Scala. The Flix Standard Library and runtime, which includes a Datalog JIT, is written in Flix. GitHub does not yet recognize .flix, so the numbers reported are an inaccurate representation of the actual code in the repo.
jorkadeen··on The Flix Programming Language
The implementation language does not affect the target "machine". Also Flix is implemented in both Scala and Flix (but GitHub does not yet recognize Flix code). Flix targets Java 11, but is moving to target Java 21, and will take advantage of all features available there, including Project Loom. We are just waiting for Java 21 to become a bit more widespread.

(I am one of the developers of Flix).

jorkadeen··on The Flix Programming Language
The situation here is not unlike the problem with null: If you allow null in your language, you will have NullPointerExceptions at runtime. Unused local variables (and other unused constructs) are known to be correlated with bugs (see e.g., Xie and Engler, 2002), so if you allow them, you will allow these bugs. So, by enforcing the absence of unused constructs, a large class of bugs is eliminated.

But I agree, this can be cumbersome. So, Flix allows any unused construct to be prefixed with an underscore to mark it as unused. (But underscored things cannot be referenced.) This seems like a pragmatic trade-off.

(I am one of the developers of Flix).

jorkadeen··on The Flix Programming Language
I think the most controversial feature is actually its effect system. Unlike division-by-zero, which is typically a rare occurrence, the effect system permeates the language and must be learned before one can write useable programs. This requires a new and refreshing mindset: I write pure functions, but inside each function, I can use mutable data structures to get the job done!

(I am one of the developers of Flix)

jorkadeen··on The Flix Programming Language
The website is infrequently updated, so let me provide some information about what we are currently working on:

- We are trying to make the entire compiler resilient (error-tolerant), incremental, and parallel. We have managed to make every single compiler phase (of which there are 28) parallel. This has already led to significant speed-ups. We are now trying to increase the degree of parallelism within each phase. We are also working on error resilience to provide LSP support no matter what errors a program contains (syntax, naming, type). For example, it should be possible to rename a variable even if the program currently has multiple errors.

- We are adding support for algebraic effects and handlers. This will allow users to define and handle their own effects.

- We are also exploring a novel way to combine type classes ("traits") and effects.

- We have recently added support for package management and integration with Maven.

In summary, we are already in a great spot, and useful programs can be written in Flix today. I encourage you to check out the documentation: https://doc.flix.dev/ and to try Flix!

(I am one of the developers of Flix).

jorkadeen··on Ask HN: What is new in algorithms and data structures these days?
What's the issue? Bug reports are most welcome.
jorkadeen··on Ask HN: What is new in algorithms and data structures these days?
You might be interested in Flix which has first-class Datalog program values:

https://flix.dev/

https://doc.flix.dev/fixpoints.html

(I am one of the developers of Flix)

jorkadeen··on My thoughts on OCaml
Thanks for the kind words.

Yes, I would definitely consider it a language in the ML-family. Its core is based on Hindley-Milner (like StandardML, OCaml, and Haskell) which I think is the hallmark of ML-family languages. Flix sits neatly between Ocaml and Haskell in that it allows side-effects (like Ocaml, unlike Haskell) but they are tracked by the effect system. Hence one can program in the spectrum between those two languages, but get strong guarantees from the compiler.

In terms of adoption, we see a lot of people trying it out, and there are some packages out there already, but nothing too big yet. We recently added support for package management, so hopefully that will help the community grow.

jorkadeen··on My thoughts on OCaml
An alternative to OCaml is Flix (https://flix.dev/) which attempts to address some of the critiques in the post. For example:

> Bad standard library

A particular goal of Flix is to have a consistent standard library based on type classes.

> Standard types are sometimes persistent, sometimes mutable. List, Map, and Set are persistent. Stack and Hashtbl are mutable.

In Flix immutable types are named List, Set, Map, etc. and mutable collections are prefixed with Mut, e.g. MutSet, MutMap, etc. Mutable data types also carry a region.

> Also, OCaml has no tracking of side-effects (like in Haskell)

Flix has an effect system that tracks purity/impurity.

(I am one of the developers of Flix)

jorkadeen··on Flix – Safe, reliable, concise, and functional-first programming language
Thanks for the kind words! To try to answer your questions:

- We are debating whether to allow a limited form of overlapping instances. No decision has been made yet.

- Flix uses the Options and Errors. Flix also has monadic let* making it easier to work with these two types.

- UFCS had to be removed because it caused unavoidable ambiguities with records :(

- I am not sure I understand the question about instance resolution. Feel free to stop by our Gitter channel to discuss further.

jorkadeen··on Flix – Safe, reliable, concise, and functional-first programming language
You are spot on. Its because we reserve `:` for type and kind ascriptions. For example, `42 : Int` or `true : Bool`. But we also have `Bool : Type`, i.e. `true : Bool : Type`. While kinds are not that common in every day code, we aim for consistency with ascriptions rather than with records. Hence we had to use a different symbol in record types.
jorkadeen··on Flix – Safe, reliable, concise, and functional-first programming language
Datalog programs are values. You can store them in local variables, pass them as arguments, and return them. If you have two Datalog values you can combine them into one (effectively it's just the union of them). This allows you to write small "Datalog fragments" and stitch them together into a larger program. The type system ensures that this stays meaningful.

(I am one of the authors of Flix.)

jorkadeen··on Flix – Safe, reliable, concise, and functional-first programming language
The color of your function can be "effect polymorphic". In other words, e.g. List.map works with both pure and impure functions. You don't have to write two versions of List.map.
jorkadeen··on Flix – Safe, reliable, concise, and functional-first programming language
At the moment the effect system only distinguishes between pure and impure (and effect polymorphic) expressions, but we are working towards a richer system. For example, we will soon be able to express something like:

  def swap!(a: Array[a, r], i: Int32, j: Int32): Unit \ { Read(r), Write(r) }
We are aware of algebraic effects and handlers, but let's just say that we prefer to underpromise and overdeliver.

(I am one of the authors of Flix.)

jorkadeen··on Flix – Safe, reliable, concise, and functional-first programming language
Be sure to check out https://flix.dev/ and https://github.com/flix/flix/tree/master/examples for more examples.

(I am one of the authors of Flix.)

jorkadeen··on Flix – Next-generation reliable, concise, functional-first programming language
In Flix, Datalog constraints are first-class values. This is strictly more powerful than a macro system. For example, the Datalog programs that are constructed can depend on input values to the program. This is not the case for macros which are expanded compile-time. (Unless you have some kind of reflection in mind...)

EDIT: I hope to explore a macro system for Flix in the future. So we are definitely on the same side of the issue; just wanted to point out that the current system is more powerful.

jorkadeen··on Flix – Next-generation reliable, concise, functional-first programming language
My understanding is that there are 15+ papers that formalize and prove soundness of various aspects of the DOT type system, but that the "full" type system implemented in Dotty today is still unsound. Hopefully this situation will improve in the future.
jorkadeen··on Flix – Next-generation reliable, concise, functional-first programming language
I think you would want both: algebraic effects and very fine-grained effect reasoning. For example, in all most all languages it is vital that functions such as "equal" and "hash" are pure. It is an open problem how to combine our fine-grained Boolean unification-based effect system with other algebraic effect systems (e.g. row polymorphic ones). I hope the future will tell :)
jorkadeen··on Flix – Next-generation reliable, concise, functional-first programming language
Thanks- I will try to get it fixed!
jorkadeen··on Flix – Next-generation reliable, concise, functional-first programming language
The alternatives are:

- Division must be impure (because it can throw an exception, crash the program, etc.)

- Division must be partial - i.e. return Option[Int].

Both seem worse compared to defining division by zero as zero. Coq, Lean, and Pony do the same. https://github.com/ponylang/pony-tutorial/blob/master/conten...

jorkadeen··on Flix – Next-generation reliable, concise, functional-first programming language
I don't think that is true. For example, Java beats OCaml on some benchmarks at: https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

It seems that the situation is not as clear cut as your post suggests.

(I am one of the authors of Flix)

jorkadeen··on Flix – Next-generation reliable, concise, functional-first programming language
Adding to that: effect inference and polymorphism, unboxed primitives, full tail call elimination, extensible records, first-class Datalog constraints, CSP style concurrency, a multitude of different design choices.

(I am one of the authors of Flix)

jorkadeen··on Flix – Next-generation reliable, concise, functional-first programming language
The Datalog implementation in Racket is neat, but does not support stratified negation nor are the Datalog constraint first-class. Both features make it significantly more practical to work with Datalog. Also, the Flix type system ensures - at compile-time - that all first-class Datalog values constructed at run-time are stratified.

The effect system in Flix is focused on a single effect: purity. It is very fine-grained (compared to e.g. systems based on rows) and it supports effect inference and effect polymorphism. Eff and Unison have richer effect systems - based on algebraic effects - which allow re-interpretation of effects. However these effects system struggle more with effect inference. For example, I believe that in Eff you only have a restricted form of effect polymorphism / the use of higher-order functions is more limited.

(I am one of the authors of Flix)

jorkadeen··on Flix – Next-generation reliable, concise, functional-first programming language
We are still figuring out the details about array impurity. But in a nutshell if something is pure it should support substitution. For example:

let x = 123; let y = (x, x)

If you substitute x into the pair you get the same result. So far, so good.

Now consider:

let x = [1, 2, 3]; x[0] = 5; let y = x[0]

If you substitute x into the body of y you get a different result! The meaning of x[0] changed underneath you. We are very conservative and say that anything which touches an array is impure. Is this the best solution? no- but it is a reasonable/sound start.

(I am one of the authors of Flix).

jorkadeen··on Flix – Next-generation reliable, concise, functional-first programming language
For example: Given the type List[Int] the cons cells of each list contain a primitive integer and a pointer to the next cons cell. (In Java, you would instead have List[Integer] where each element of the list is a boxed/wrapped Integer object). I hope that answers your question?

(I am one of the authors of Flix).

jorkadeen··on Flix – Next-generation reliable, concise, functional-first programming language
I think your comment is covered in the FAQ:

https://flix.dev/faq/

> Can we just stop building new programming languages?

We build new programming languages and we do research on programming languages because we want to offer developers better tools to write programs. We want tools that make it simpler, safer, and faster to write correct programs. We want tools that increase productivity and that aid in program maintenance.

The situation is not unlike why we would want better airplanes, better houses, or better surgical instruments.

(I am one of the authors of Flix)

jorkadeen··on Flix – Next-generation reliable, concise, functional-first programming language
At the moment it uses a technique called "Impure Functional Objects" - which are a form of reusable stack frames. In the future we may switch to trampolines and eventually if Project Loom succeeds we will try to use whatever infrastructure they come up with.

(I am one of the authors of Flix)

jorkadeen··on Flix – Next-generation reliable, concise, functional-first programming language
> This seems fine I guess, but just another "check all the boxes" language that doesn't really bring much of anything obvious new to the table.

Flix aims to occupy a unique point in the design space. It combines features from programming languages like Go, Haskell, OCaml, and Scala in a way that no other language does. It has:

- a sound type system (like Haskell and OCaml)

- a complete local type inference algorithm (like Haskell and OCaml)

- eager evaluation (like OCaml and Scala)

- CSP style concurrency (like Go)

- type classes (like Haskell)

- full tail call elimination (like OCaml and Haskell)

If you look at the "Innovations" page you will find that Flix has (at least) two features found in no other programming language: a polymorphic type and effect system and first-class Datalog constraints.

(I am one of the authors of Flix).

← PreviousPage 2 of 2