There is not a single example in the README. I checked the step-by-step guide, but it starts with installation and documentation instructions, then imports, and I don't know yet how the language feels like. Ok, let's check that handbook then. Computation model, type system, ...
Please, I just want to see a program with a dozen lines of code to see what it looks like. Of course, more extended examples with the intended usage would also be very welcomed.
isn't this a little demanding and entitled? for example, the submitter of this post to hacker news may not be the creator of the language and repository. so the creator is off just having some fun creating a language, with more than minimal documentation, and uploads it to github to track changes and generally make it public. then someone thinks it's interesting and posts it here, and the top comment is someone with too aggressive of a tone, in my opinion.
The poster shared it to HN because they want other people to look at it. Which is fine, but they're asking for our attention, and they need to respect that fact—and us—and not waste our time. Sharing a new language but making us dig around to understand one of the most fundamental things about the language—what the code looks like—does not respect us, our time, or our attention. If that's a problem, they can keep it a private repo, and not share it on HN.
The point of posting things on a site with comments is so people can comment on them. Even if we knew for a fact that the poster wasn't the creator, it would still be appropriate to comment on an annoying aspect of the project.
I can't be the only one who's annoyed by language writers introducing arbitrary uncommon syntax apparently just for the sake of doing something new?
Lua's great little language but writing ~= instead of != is simply annoying. In this "Ko" language, it looks like they do returns with a colon, as in "return: x" -- why??? I won't even go into Rust picking up Perl's bad habit of looking like line noise with all the ASCII sigil usage in advanced code.
Also, any language which doesn't have a "hello world" example in its front page is doomed. Even such a wide-spread language as Python has code snippets practically first thing on its web page! This is not by accident!
I would sympathize with using =/= for "not equal" because it is ASCII art for the traditional mathematical notation of using an equal sign with a line through it. Though it might be better just to permit carefully selected unicode characters such as https://www.fileformat.info/info/unicode/char/2260/index.htm
=/= is disappointing as art because it is too wide, but it has obvious mnemonic power.
Would you object to =/= as "arbitrary uncommon syntax" because it is poor art? Does its mnemonic power save it from the criticism of being "new for the sake of new"
I love the generic function aspect of this, where there aren't necessarily specific inputs or outputs. This will make code reusable by factors. A simple use being not needing to define both `toRadians` and `toDegrees`, just definite the relationship. But I believe this can be taken to the point of getting backpropagation for free once forward propagation is defined in neural networks.
Not to steal any thunder, but I've been prototyping a language very built on this idea.
I could be jumping to an incorrect conclusion, but I think you are misreading the description of Ko's genericity. It doesn't mean that inputs and outputs are not distinguished. It just means that arguments and return values aren't explicitly typed. The kind of Prolog-style unification you are talking about is something different.
Is this a research language? I don't understand how this offers anything beyond what already exists.
I'm also suspicious of the fact that it's implemented in Go. I would think that someone who knew functional programming well enough to create a new language would implement the language in Haskell or OCaml or even Standard ML.
Also the type system looks pretty bad. No algebraic data types.
> Most of the newer popular functional languages aren't implemented in those, but rather Java
Well, that's not entirely correct. I assume you mean they run on the JVM? Language like scala are actually written IN scala. The only thing that is in java is the interpreter but the entire compiler is scala.
> Most of the newer popular functional languages aren't implemented in those, but rather Java,
I don't think this is true. Java is not a good language for compilers in any case, and it would cause me to trust the language less, especially if they were claiming it was a "functional programming language"
So you are both right; language quality is a function of the language itself, but if we don't yet know much about the language or its author, there is a correlation ("confounding") between language quality and the choice of the implementation language, so if that's the only information we have, might as well take advantage of it.
I am not weighing in here on what specifically the choice of Haskell, OCaml, or Go say about author's competence; I am simply addressing your point that the choice shouldn't matter at all—unless you are convinced that the knowledge of PL theory and design principles is uniformly distributed across all language communities.
Except that Haskell and OCaml as implementation languages would signal huge academic bias and therefore likely inability to come up with a usable language or at least there exists a negative correlation with those languages.
I don't agree with "unusable" but "academic" probably has some justification.
The fact that it has a "let" keyword does make it "academic" to me. I'm fairly sure we can now have compilers that don't need such hints to be explicitly provided. Rust enjoys its let keyword so much they have a "If let" syntax.
Languages that use random punctuation without providing real benefit could also use a cleanup. Lua with ~= is a good example: Tilde in mathematics means "approximate". In C != means "not equal". So lua's designers can be accused of either never seeing C or deliberately choosing something different. Given that Lua is implemented in C they can't easily claim ignorance.
Archaic and awkward ways of expressing code shouldn't be propagated into new languages unless here is a clear benefit. Have a look at Erlang. Excellent overall but has lots of old warts from yesteryear you wouldn't want in a modern language. Eg look at its string syntax / naming rules. Now compare it to Elixir. Modern. Same VM.
Moving with the times is useful. Future languages shouldn't be adding debris everywhere just to be different.
It's not a matter of "search for simplicity"; the grammar is just inherently ambiguous without some sort of token in this position. let was taken from OCaml, where a lot of inspiration from Rust came from.
(As a reader, it's also really nice to be able to see "there's a new variable being created here" at a glance. Ambiguity is a human problem as well as a computer problem.)
I'm mostly just saying "if the authors were experts on functional programming, surely they would use Haskell or OCaml?" My problem is not with the compiler/implementation but rather the fact that they are trying to sell a new functional language without having taken stock of the existing offerings.
This is interesting. I see it has an interpreter, but it's unclear at a glance whether "interpreted" is the default production mode of the language or if the interpreter is available to facilitate a repl or smething.
Skimming some of the .ko files, I like that it seems readable and familiar (even if there are some oddities). No matter how much time I spend with Haskell and OCaml, I always spend conscious effort trying to mentally parse the source code.
Something I noticed while working on it is that the declarative style is not always the most comfortable way to describe things, and well-written imperative code is declarative in its own way. Somewhere in most useful programs, it helps to have the imperative escape hatch until you can support the best declarative expression.
- The simple assignment syntax looks somewhat procedural and is easy to read in small hunks at a time, but is still functional. I like this. This meshes well with the very real limits of how the human brain can parse things.
- I wish there were type declarations. There's a type system, but it seems to be all inference. Type declarations just at the function inputs and outputs (and leaving it pure inference in the middle) would promote readability when you've got no compiler in hand and are just eyeballing the pure text, in my opinion.
- I'm surprised by the inclusion of a system of nonlocal returns (panic/recover). It still looks relatively functional, but A) boy that's not an area where the word "relatively" is comfortable to use and B) I shudder to think what the inferred types will tend to explode into when using this feature (an Either of an Either of an Either of a ...?) in a nontrivial program (and the examples don't really shed light on that either, due to the "all inference" model leaving us with no plain text declarations of types in sight).
- I haven't seen any examples yet of what happens and how you're supposed to resolve it when the type inference can't quite figure it out. There seem to be some examples of doing explicit casts which seems to be a workaround for this, but I don't see it discussed very clearly.
- The quick and easy syntax for returning new record/structure types seems nice. Though I'm again a tad worried that the range of types I could end up producing would get pretty large.
- The syntax holistically seems to keep things from "drifting to the right", which seems to be a common readability cramp that emerges in many functional languages. Nice.
- Using the term "Variety" for roughly "closure" is... very nonobvious to me. But I shouldn't nitpick on terminology. (And for what it's worth, I read the protobuf that Ko uses internally to define its types of types before anything else, and so maybe I'd be less surprised if I had encountered it from from the docs and lessons first.)
Caveat: these are all "hot takes" from the couple dozen minutes of digging I've done so far. I might be reading some things wrong or have missed some documentation, so take these comments with a grain of salt and do your own looking as well.
Overall, this seems neat, but simultaneously leaves me a little worried that I'd be able to too easily write things in which the type inference finds something that compiles, but isn't the type that I would've declared.
I'd be really interested to see what this shapes up like if combined with some system for explicit type declaration. Gluing Ko together with a serial data schema like Protobuf and using Ko for "migrations" seems like it could be a really useful combination, for example.
Couldn't find it easily, but what model are they using to make this dead-lock free as they advertise? I've seen a number of languages try to accomplish this same goal but usually with a huge caveat on what kinds of programs are allowed, or by randomly killing threads when a dead-lock is detected.
Even with Haskell you can still have deadlocks . They give you the tools to write code that you can prove won't have them, but restricting the kinds of programs you can write. But it's an opt-in thing, it's not a promise of the language that you can't do it. Rust is trying to do a similar thing, but it's still also possible to write yourself into a corner with deadlocks if you work against the feature.
Another language I saw recently that has this promise was Pony which uses an actor and message passing model to try to accomplish this but it doesn't actually prevent you from hitting the case, instead it'll just kill a random actor until the deadlock is gone . This can work but it needs to be up front that you MUST write your software to be ready to be killed at any time and continue to function.
It's really an impossible situation to completely "solve", given that doing so would require a solution to the halting problem. So it's always a fun place for me to start looking at any new language if they talk about locks and dead-locks. So far I think Haskell and Rust (and probably other ML family) have the best balance being struck since you can opt in to statically proving this if you restrict those parts of your program but you're not required to do so by the language itself.
that is, even a positional parameter can be passed by name if you insist.)
Coming back after reading on, I see you let Eq and Sum and such get by without argument names. Generally a language should not reserve privileges for itself that it does not grant to its users without a really good reason.
https://github.com/kocircuit/kocircuit/blob/master/lessons/1... : I literally have no idea how you are using the word "monadic" in this section; it is neither the proper mathematical term, nor the very close Haskell term, nor any subsequent misunderstanding I've ever seen of the Haskell term ported into other languages, nor can I particularly connect it to the philosophical meaning, nor do I (glancing ahead) see any other documentation for it. My search was not exhaustive, but taking such liberties with a term like that sets off a lot of flags for me.
https://github.com/kocircuit/kocircuit/blob/master/lessons/1... : This is, IMHO, a rather dirty hack around trying to copy the way pure Haskell code can implement definitions without much concern for order, while at the same time having side effects in the code. That "DoubleGreeting" on the bottom is getting really ugly (and I mean in terms of the semantics of what is being represented there, not the surface syntax layer), and it's still in the sample code, where things should be looking artifically fake-pretty because the real-world hasn't intruded yet. It's a solution to a problem that shouldn't have been introduced in the first place.
https://github.com/kocircuit/kocircuit/blob/master/lessons/3... : I expect "repeated assignment" will be difficult to follow with nested structures. Also, what happens if I move yearOfBirth below the repeated "occupations"? My point here is not that there isn't an answer; it's that I can come up with 3 or 4, which is the real problem.
General comment: Using the functions for flow control is OK, but combining that with arbitrarily-reorderable function argument parameters is crazy. Anyone who writes If(else: ..., when: ..., then: ...) is just insane anyhow, so don't even allow it in the syntax/grammar, because it will happen. It seems to me you basically have an imperative language trying to look functional, while I see little to nothing "functional" about it, and you'd be better off just being an imperative language and take advantage of structured programming's implicit control flow <-> source code layout correspondence. You're paying the price for some things you're not successfully taking advantage of.
My summation is that even in the examples, I'm seeing a lot of little quibbles stack up and become some big problems, and that's before I'm trying to actually code in this. I'd suggest some more thinking about the language's goals, and ensuring that every feature is in harmony with that goal and everything not necessary for it has been cut, because that is not where this language is right now.