Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
jorkadeen
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
5 ms
·
1.
▲
Making Flix Compiler Errors Helpful and Delightful
(blog.flix.dev)
4 points
by
jorkadeen
8mo ago
|
0 comments
2.
▲
by
jorkadeen
1y ago
We can certainly extend it to a language feature-- if there are good use cases. Do you have some specific special effects in mind?
3.
▲
by
jorkadeen
1y ago
It was a simple example; whether a specific optimization applies is very tricky. We have to look at the details. When can Rust move or eliminate a binder? Does Rust support automatic parallelization? What happens if you use unsafe blocks to
4.
▲
by
jorkadeen
1y ago
We think that functional programmers should be able to write e.g. `List.count(x -> x > 5, l)` (or e.g. use pipelines with |>) and have it run as fast as an ordinary imperative loop with a mutable variable. The Flix compiler gives t
5.
▲
by
jorkadeen
1y ago
A few other languages are: - https://effekt-lang.org/ - https://koka-lang.github.io/ - https://www.unison-lang.org/ - https://antelang.org/
6.
▲
by
jorkadeen
1y ago
The challenge is that the compiler uses the type-and-effect system for many of its tasks, including whole-program optimization and code generation. If printing- or logging statements have no effect, the compiler might reorder them or even r
7.
▲
Effect Systems vs. Print Debugging: A Pragmatic Solution
(blog.flix.dev)
11 points
by
jorkadeen
1y ago
|
0 comments
8.
▲
by
jorkadeen
1y ago
Flix does not have significant whitespace. Where did you run into trouble? You are welcome to swing by Gitter if you need help. We are friendly :-)
9.
▲
by
jorkadeen
1y ago
You can always add your own `safeDiv` function :-) I believe native compilation is possible via Graal native-image-- but I have not yet tried it.
10.
▲
by
jorkadeen
1y ago
We plan to explore semicolon inference in the future; but there are a lot of dangerous corner cases to consider.
11.
▲
by
jorkadeen
1y ago
Thanks-- I fixed the links!
12.
▲
by
jorkadeen
1y ago
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.
13.
▲
by
jorkadeen
1y ago
In the uncommon case, some stack frames must be heap allocated. This is unavoidable when (a) the runtime enviroment, here the JVM, does not support tail calls, and (b) the language wants to guarantee that _any_[1] tail call does not grow th
14.
▲
by
jorkadeen
1y ago
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
15.
▲
by
jorkadeen
1y ago
That's me. But I must admit that I prefer Cholula Hot Sauce. In addition to the imperative `foreach` construct, Flix has two constructs for applicative[1] and monadic[2] comprehensions: `forA` and `forM`. Since applicatives and monads
16.
▲
by
jorkadeen
1y ago
But in Flix you can write: def main(): Unit \ IO = Map.empty() |> Map.insert("Hello", "World") |> Map.get("Hello") |> println So I am not sure what you mean? In general,
17.
▲
by
jorkadeen
1y ago
That's right. Locally scoped mutable memory in Flix is very similar to the ST Monad. The two major differences are: (a) Flix is in direct-style vs. monadic style and (b) we use a type and effect system. Note that there is no requiremen
18.
▲
by
jorkadeen
1y ago
All excellent points. I think when it comes to programming language design, sometimes I feel that a design has a 90% chance of being good and a 10% chance of being bad. For the logic constraints (right-to-left vs. left-to-right), I think my
19.
▲
by
jorkadeen
1y ago
Not sure I agree. A simple example: If your language has null as a subtype of every type then you will have null ptr exceptions everywhere. If your language does not have a null value then you won't. The situation is not as clear cut a
20.
▲
by
jorkadeen
1y ago
There is no significant indentation. What leads you to be believe that?
21.
▲
by
jorkadeen
1y ago
The StringBuilder example is just that-- an example that many software developers should be familiar with. The deeper idea is that in Flix one can write a pure function that internally use mutation and imperative programming.
22.
▲
by
jorkadeen
1y ago
The parent poster is correct. We do monomorphization, hence Flix types are unboxed. For example, a `List[Int32]` is a list of primitive integers. There is no boxing and no overhead. The upshot is that sometimes we are faster than Java (whic
23.
▲
by
jorkadeen
1y ago
I strongly agree. Java and JVM bytecode may not be our "cup of tea", but it is simply unrealistic to implement any runtime environment with comparable performance, security, robustness, and tooling. The only alternative is WASM, b
24.
▲
by
jorkadeen
1y ago
It is a fair point-- the implicit argument being that this allows `c` and `d` to be bound before they are used, and hence auto-complete can assist in the `select` clause. Nevertheless, the counter argument is that the form of a logic rule i
25.
▲
by
jorkadeen
1y ago
The JVM (and other VMs for that matter) do not grant direct access to the stack. But the good news is that the common case incurs no overhead.
26.
▲
by
jorkadeen
1y ago
We have to emulate tail calls using trampolines. This means that in some cases we have to represent stack frames as objects on the heap. Fortunately, in the common case where a recursive function simply calls itself in tail position, we can
27.
▲
by
jorkadeen
1y ago
Cool blog post! With your permission, I would be happy to add it here: https://doc.flix.dev/blog-posts.html The language has improved a lot in the years since the post. In particular, the effect system has been significantl
28.
▲
by
jorkadeen
1y ago
Flix supports type classes (called "traits") with higher-kinded types (HKTs) and with associated types and associated effects. A Flix trait can provide a default implementation of a function, but specific trait instances can overr
29.
▲
by
jorkadeen
1y ago
In Flix all effects are tracked by the type and effect system. Hence programmers can know when a function is pure or impure. Moreover, pure functions can be implemented internally using mutation and imperative programming. For example, in F
30.
▲
by
jorkadeen
1y ago
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.
More ›