Koka is a function-oriented language where functions and data form the core of the language (in contrast to objects for example). In particular, the expression
s.encode(3)
does not select theencode
method from thestring
object, but it is simply syntactic sugar for the function callencode(s,3)
wheres
becomes the first argument. Similarly,c.int
converts a character to an integer by callingint(c)
(and both expressions are equivalent). The dot notation is intuïtive and quite convenient to chain multiple calls together, as in:fun showit( s : string ) s.encode(3).count.println
for example (where the body desugars as
println(count(encode(s,3)))
). An advantage of the dot notation as syntactic sugar for function calls is that it is easy to extend the ‘primitive’ methods of any data type: just write a new function that takes that type as its first argument. In most object-oriented languages one would need to add that method to the class definition itself which is not always possible if such class came as a library for example.
Sunday, December 31, 2023
Dot selection
Minimal but General
Koka has a small core set of orthogonal, well-studied language features – but each of these is as general and composable as possible, such that we do not need further “special” extensions. Core features include first-class functions, a higher-rank impredicative polymorphic type- and effect system, algebraic data types, and effect handlers.Koka - A Functional Language with Effect Types and Handlers
Friday, December 29, 2023
Tuesday, December 26, 2023
Monday, December 25, 2023
Tuesday, November 21, 2023
Tuesday, October 03, 2023
Wednesday, September 13, 2023
Saturday, July 29, 2023
Thursday, July 27, 2023
Sunday, July 23, 2023
Sunday, May 21, 2023
Thursday, March 09, 2023
Sunday, February 26, 2023
Tuesday, February 07, 2023
Saturday, January 14, 2023
you knew that in time, we would bring ruin to it as well
"What led us here? You did. You vile blasphemies.
Machines... thinking... breeding... you were to bear us a new, promised land.
But when you arrived at that distant world... you knew that in time, we would bring ruin to it as well.
As we had to Earth..."
Subscribe to:
Posts (Atom)