[HN Gopher] Flix - Safe, reliable, concise, and functional-first...
       ___________________________________________________________________
        
       Flix - Safe, reliable, concise, and functional-first programming
       language
        
       Author : nikolay
       Score  : 133 points
       Date   : 2022-05-20 15:35 UTC (3 days ago)
        
 (HTM) web link (flix.dev)
 (TXT) w3m dump (flix.dev)
        
       | hulitu wrote:
       | > Flix - Safe, Reliable, Concise, and Functional-First
       | Programming Language
       | 
       | "Ensure that you have at least Java 11 installed. "
       | 
       | How about a compiler or an interpreter ?
       | 
       | "Download the latest version of the Flix compiler (flix.jar) at
       | https://github.com/flix/flix/releases/latest.
       | 
       | Create an empty folder (e.g. mkdir flixproject) and place the
       | downloaded Flix JAR (flix.jar) into that folder.
       | 
       | Enter the created directory (e.g. cd flixproject) and run java
       | -jar flix.jar init to create an empty Flix project.
       | 
       | Run java -jar flix.jar run to compile and run the project.
       | 
       | Flix will compile the project and execute the main function
       | (located in src/Main.flix).
       | 
       | "
       | 
       | So getting started is about running an empty project file ? How
       | about some code examples ? I wanted to see what is a "Safe,
       | Reliable, Concise, and Functional-First Programming Language".
       | And all i get is an empty project ?
       | 
       | After reading some docs it looks like a lisp without parantheses
       | and one has to have a good understanding of lambda functions to
       | be able to read the documentation.
        
         | jorkadeen wrote:
         | 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.)
        
         | Smaug123 wrote:
         | Scroll down! The homepage shows examples of ADTs, purity
         | tracking (yay!) and pattern matching on purity (oooooh), effect
         | polymorphism (oooooh again), type classes, HKTs, and an
         | embedded Datalog DSL.
        
         | all2 wrote:
         | I rather liked Nim's one line install of a binary. Starting and
         | running a project is as simple as "nim c -r <file_name>.nim".
         | 
         | I appreciate languages/toolkits that are concise in their
         | tooling. Golang is another language like this. The tooling is
         | simple (though Golang is more opinionated than Nim in things
         | like testing and project layouts) and easy to reason about.
        
       | lucas_membrane wrote:
       | Many languages running on JVM boast of an FFI allowing use of
       | much existing code already written in Java. Is such, or will such
       | be, possible in Flix?
       | 
       | What is the overall status of the implementation, particularly
       | for real world applications (features like talking to a network,
       | file systems, databases and operating system, and/or FFIs for JVM
       | or non-JVM languages)?
        
         | mjs2600 wrote:
         | I found this[1] section in the documentation on
         | interoperability within the JVM. It looks fairly
         | straightforward to work with. I'm not sure about FFI more
         | generally.
         | 
         | [1] https://doc.flix.dev/interoperability/
        
       | rco8786 wrote:
       | Looks interesting, will definitely dig into. Right off the bat
       | though, I see 3 different syntaxes for typing?
       | 
       | > case Rectangle(Int32, Int32)
       | 
       | > def origin(): (Int32, Int32) =
       | 
       | > def twoByFour(): {w :: Int32, h :: Int32} =
       | 
       | case Rectangle: (Int32, Int32)
       | 
       | def origin(): (Int32, Int32)
       | 
       | def twoByFour(): (w: Int32, h: Int32)
       | 
       | ?
        
         | djur wrote:
         | The first one is part of the syntax for defining a sum type,
         | the second is a function returning a tuple, and the third is a
         | function returning a record.
        
       | codeptualize wrote:
       | Love the FAQ page!
        
       | gunshowmo wrote:
       | This is an extremely strong set of features in one language. All
       | the best in this project!
        
       | mindcrime wrote:
       | Wow, this looks pretty exciting. Like @jitl said, the idea of
       | built-in Datalog support sounds _really_ interesting. I don 't
       | know how I missed the earlier announcements of this, but now that
       | I found it I'm definitely going to give it a spin.
        
       | the_duke wrote:
       | Sadly the effects system seems to be just "pure vs impure"
       | tracking per function. No arbitrary effects or custom handlers.
       | 
       | Is that accurate?I was hoping for something more like Koka.
       | 
       | Otherwise that is a very intriguing combination of features,
       | especially first class Datalog constraints.
       | 
       | Any plans for additional backends? (native, Webassembly)?
        
         | kldx wrote:
         | Is this what I think it is?
         | 
         | Ref. _What color is your function_
        
           | jorkadeen wrote:
           | 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 wrote:
         | 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.)
        
       | dang wrote:
       | Related:
       | 
       |  _In Defense of Programming Languages_ -
       | https://news.ycombinator.com/item?id=27799063 - July 2021 (1
       | comment)
       | 
       |  _Flix - Next-generation reliable, concise, functional-first
       | programming language_ -
       | https://news.ycombinator.com/item?id=25513397 - Dec 2020 (84
       | comments)
       | 
       |  _The Flix Programming Language_ -
       | https://news.ycombinator.com/item?id=19928153 - May 2019 (2
       | comments)
        
       | jitl wrote:
       | The Datalog support is a very interesting feature for such a
       | fully-featured language. From the home page:
       | def reachable(g: List[(String, Int32, String)], minSpeed: Int32):
       | List[(String, String)] =             let facts = project g into
       | Road;              let rules = #{                 Path(x, y) :-
       | Road(x, maxSpeed, y), if maxSpeed >= minSpeed.
       | Path(x, z) :- Path(x, y), Road(y, maxSpeed, z), if maxSpeed >=
       | minSpeed.             };             query facts, rules select
       | (src, dst) from Path(src, dst) |> Foldable.toList
       | 
       | Composing datalog natively like any other type - very cool.
        
         | all2 wrote:
         | > Composing datalog natively
         | 
         | I'm naive. What does this mean and why is it important?
        
           | jorkadeen wrote:
           | 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.)
        
           | pharmakom wrote:
           | Just look at any template heavy c++ library.
        
             | Blackthorn wrote:
             | That really doesn't answer the question. (I'm not sure what
             | it really means either, it's a good question.)
        
           | machiaweliczny wrote:
           | In short you work with tree (AST) and can compose instead of
           | stiching strings (builder pattern)
           | 
           | Good thing of having common AST in language is libs
           | interoperability.
           | 
           | It's like normal lanugages had SQL support built-in (except
           | you can't do that easily as SQL is order dependent)
        
           | [deleted]
        
       | james-redwood wrote:
       | > Flix looks quite similar to Scala. How are the two languages
       | related?
       | 
       | > Flix borrows a lot of syntax from Scala, hence the two
       | languages have a similar feel. We think Scala made many good
       | design choices with respect to syntax, including: (a) the use of
       | short keywords, (b) the x : T syntax for type annotations, (c)
       | the List[Int32] syntax for type parameters, and (d) if, match,
       | etc. as expressions.
       | 
       | > Other than syntax, the two languages are very different: Scala
       | is object-oriented, Flix is not. Scala has sub-typing, Flix does
       | not. The Scala type system is unsound and has imperfect type
       | inference, whereas the Flix type system is both sound and
       | supports type inference.
       | 
       | https://flix.dev/faq/
        
       | LesZedCB wrote:
       | wow this is a really pretty language, nice work to the authors.
       | definitely will be giving it a shot
        
       | zinclozenge wrote:
       | I've had my eye on flix for a while. I really like the feature
       | set.
        
       ___________________________________________________________________
       (page generated 2022-05-23 23:00 UTC)