News for hackers. Stuff that matters.
Re:Koto Programming Language by fstarship on Saturday March 29, 2025 @09:11AM (#43515249)
It seems every scripting language does duck/dynamic typing (as far as I can tell this applies to Koto).

I don’t understand why… inferred typing is nearly as easy to use while being more robust.

For me the biggest gap in programming languages is a rust like language with a garbage collector, instead of a borrow checker.

Rust has a lot of features that should be strongly considered for the next generation of programming languages such as

result/sum types

Inferred typing

Not object oriented or overly prescriptive with functional programming.

I think the closest language to filling that gap is occaml (I am not familiar with it).

I have coworker's that are more skilled in domain logic that can write basic self contained programs, but stuff like traits, OOP functional programming is a bridge too far.

I feel like a language that fills that gap could be useful, context is a manufacturing ERP system.

Re:Koto Programming Language by ossopite on Saturday March 29, 2025 @09:42AM (#43515470)
I think you really are describing ocaml, which is a great language, although its ecosystem isn't the best. It probably inspired most of the features you mentioned in rust. It also supports OOP (hence the O) but it's easy to avoid.

That said, I wouldn't compare it to scripting languages. The lack of implicit conversions / traits / ad-hoc polymorphism means it's not that convenient for scripting.

Re:Koto Programming Language by jeltz on Saturday March 29, 2025 @11:23AM (#43516250)
Ruby does very little implicit type conversion and is great for scripting. I think implicit type conversion is not required or even a good thing for scripting languages.
Re:Koto Programming Language by raphinou on Saturday March 29, 2025 @11:21AM (#43516239)
Fsharp, which originally was ocaml on dotnet, can also be run as scripts. It is a really practical way to start a project. I blogged about it here: https://asfaload.com/blog/fsharp-fsx-starting-point/
Re:Koto Programming Language by soulbadguy on Saturday March 29, 2025 @04:50PM (#43518629)
Fsharp is such a nice languange. Such a shame that I never seem to get the light it deserves. Between the alternative light syntax, type providers and first class "scripting" mode supported it really was a great middle point between fully scripting language and fast prototyping and full blow projects
Re:Koto Programming Language by int_19h on Sunday March 30, 2025 @12:06AM (#43521243)
F# was never really "OCaml on .NET", though, not really. ML on .NET, sure, but it is (and always has been) missing OCaml's most interesting features, such as functors and OO with inferred row-types.
Re:Koto Programming Language by raphinou on Sunday March 30, 2025 @06:57AM (#43523156)
It probably was too much of a shortcut, thanks for the correction.
Re:Koto Programming Language by int_19h on Monday March 31, 2025 @03:24AM (#43532150)
They have kinda positioned themselves that way and had (have?) syntactic compatibility with a subset of OCaml. And OCaml is probably the least obscure of the ML language family, so it's not exactly surprising.
Re:Koto Programming Language by threatofrain on Saturday March 29, 2025 @10:47AM (#43515996)
Implicit conversion is not obviously that convenient for scripting. The JS community has largely moved to anti-recommend implicit conversion, such as by basically striking `==` from their vocabulary.
Re:Koto Programming Language by nerdponx on Saturday March 29, 2025 @09:52AM (#43515550)
Nim was great along these lines when I tried it. But that was before the v2.0 which apparently was accompanied by drama and a fork.
Re:Koto Programming Language by rattray on Saturday March 29, 2025 @10:45AM (#43515988)
What happened?
Re:Koto Programming Language by archargelod on Saturday March 29, 2025 @09:13PM (#43520282)
If I remember correctly, main reason for forking was that Nim BDFL was writing lazy commit messages and old codebase was hard to navigate around. Some small part of community forked the language and trying to rewrite the compiler. According to readme they're not trying to replace Nim, but to create new language with Nim as base. Not sure how usable it's right now or will it ever be.

I also want to point out that Araq quickly took the criticism and his commits look a lot better now.

Also, core Nim team is currently working on their own rewrite of Nim compiler, called Nimony, that should evolve into Nim 3.

Refs:

fork - https://github.com/nim-works/nimskull

commit 'drama' - https://news.ycombinator.com/item?id=32021299#32023998

nimony - https://github.com/nim-lang/nimony

Re:Koto Programming Language by xigoi on Saturday March 29, 2025 @03:53PM (#43518155)
What makes OCaml inconvenient for scripting is how difficult it is to run code that uses some external libraries. You basically need to create a whole project structure with several config files, which creates a lot of friction compared to `import numpy as np`.
Re:Koto Programming Language by zozbot234 on Saturday March 29, 2025 @11:38AM (#43516356)
Rust will probably gain support for "pluggable" and optional garbage collectors as part of its upcoming local allocators API. This will ultimately give devs the best of both choices - use tracing GC where it's actually needed (because you're working with totally general graph-like data and that's the only feasible memory management strategy) and manual memory management (supplemented by RAII and reference counting) elsewhere - for other parts of the program that don't have to manage general "spaghetti" graphs. Unfortunately the way GC's trace memory and collect garbage varies widely among implementations, so there's no easy way to standardize a "generic" interface to pluggable garbage collection. that all custom crates can be expected to tap into by default. But other uses should be quite feasible.
Re:Koto Programming Language by SkiFire13 on Saturday March 29, 2025 @02:10PM (#43517367)
> Rust will probably gain support for "pluggable" and optional garbage collectors as part of its upcoming local allocators API.

Source? AFAIK there's no confirmed upcoming allocators APIs, and even if there was they would just allow reusing the builtin `Box`/`Vec`/etc etc with custom allocators. This is not much different than what you could do with a custom type, so I find it hard to believe it would allow garbage collectors that are not possible right now.

Re:Koto Programming Language by pansa2 on Saturday March 29, 2025 @10:17AM (#43515754)
> It seems every scripting language does duck/dynamic typing (as far as I can tell this applies to Koto).

It looks like Koto supports type hints - not sure if these are checked at compile-time, run-time, or both.

> I don’t understand why… inferred typing is nearly as easy to use while being more robust.

Is it (nearly as easy to use)? Every static type system seems to have special cases and exceptions which are avoided by dynamic typing. I'd love to find one that's actually simple.

Also, it's definitely not nearly as easy to implement - which is important for a language being designed and built by a small team and targeting a lightweight runtime.

Re:Koto Programming Language by tuveson on Saturday March 29, 2025 @12:14PM (#43516587)
> Also, it's definitely not nearly as easy to implement

I think this is the real reason why there are so many dynamic language implementations. If you want to implement a dynamic language, you just slap a type tag on your runtime objects and boom, your "type system" is done.

Dynamic languages get a lot of expressiveness "for free", whereas having a really expressive static type system requires a lot of work. It's not that hard to get a type system on the level of C, but if the language is interpreted, it's still going to be pretty slow.

I do think there can be benefits to having typing in a scripting language (and not a bolted-on type system like typescript or mypy). It's much easier to work with an FFI if the type system of the scripting language maps closely to the implementation language. It also does make it much easier to optimize the language down the line, if that becomes a priority. Making a fully dynamic language efficient is very, very difficult.

Re:Koto Programming Language by pansa2 on Saturday March 29, 2025 @11:15AM (#43516183)
> not sure if these are checked at compile-time, run-time, or both

It looks like Koto only checks types at run-time. That means its type annotations are essentially shorthand for something like Python's `if not isinstance(...): raise TypeError`.

Re:Koto Programming Language by irh on Saturday March 29, 2025 @03:23PM (#43517878)
Yes that's right, they're checked at runtime (with the option to disable the checks if the performance cost is a concern) and failed checks simply throw exceptions.

The hints aren't used for other purposes at compile time yet, but they could enable some warnings.

Re:Koto Programming Language by rapind on Saturday March 29, 2025 @09:42AM (#43515465)
I'd keep an eye on Roc https://www.roc-lang.org/

Also, Elixir is working on gradual types, which is something I would keep an eye on. https://hexdocs.pm/elixir/main/gradual-set-theoretic-types.h...

https://www.youtube.com/watch?v=giYbq4HmfGA&t=1s

Re:Koto Programming Language by no_wizard on Saturday March 29, 2025 @11:40AM (#43516366)
I want Clojure on Rust, or a similar LISP.

Such a great programming paradigm that sadly has few breakout successes

Re:Koto Programming Language by whytevuhuni on Saturday March 29, 2025 @12:34PM (#43516701)
I'm having a hard time picturing that. What would it look like?
Re:Koto Programming Language by no_wizard on Saturday March 29, 2025 @07:10PM (#43519594)
Like Clojure having access to the Java ecosystem it would need access to the Rust ecosystem I imagine.

I otherwise am unsure what you mean

Re:Koto Programming Language by cultofmetatron on Saturday March 29, 2025 @12:28PM (#43516664)
roc as a language looks really interesting but its by elm devs and I don't have much confidence in their ability to handle the transition to being a widely used language with all the cultural shifts that requires.
Re:Koto Programming Language by Hasnep on Saturday March 29, 2025 @12:37PM (#43516732)
It's created by Richard Feldman who was big in the Elm community, but I think most contributors to the Roc compiler have only used Elm a bit or have never used it.
Re:Koto Programming Language by rapind on Saturday March 29, 2025 @08:52PM (#43520145)
I hear ya, but Elm allowed me to eject out of the javascript churn for the past 7 years while still building some slick UIs that basically never fall over. I literally don’t know or care what the current hotness is in javascript, and that’s how I like it.

If roc ends up being even close to that productive for me, I really don’t care how widespread it is. I like these thoughtful unrushed languages that I can support for years without stress.

Re:Koto Programming Language by cultofmetatron on Saturday March 29, 2025 @10:18PM (#43520651)
> but Elm allowed me to eject out of the javascript churn for the past 7 years while still building some slick UIs that basically never fall over.

Thats the real tragedy. Elm was a good language but the culture around it means it could never achieve critical adoption. It is great technology for building frontends but how easily will I be able to maintain that app as the web changes over the years?

Re:Koto Programming Language by rapind on Saturday March 29, 2025 @10:51PM (#43520830)
I can only speak from experience, but it's been absolutely solid, incredibly easy to maintain (because there's been so little change), and I don't feel like I missed out on any groundbreaking front end tech at all. I literally have some elm code that's been in production doing it's thing for 7+ years without any maintenance, but more importantly it's not scary to open it up and make changes 7 years later either.

I doubt it's a silver bullet for everyone, but it's been phenomenal for me as a solo dev w/ my own product. I feel so much better about my elm code than I do about my React code. I have to do all the other things, like marketing, sales, training, support, back end, etc. It's nice to launch a UI and know it'll last (and also that it's easy to refactor and augment too!). Elm has turned my into a statically typed functional fanboy. It's been a gateway drug to Haskell, OCaml, and F#.

I see the same promise with Roc, although I bet Richard will update it more frequently than Evan w/ elm after 1.0.

Re:Koto Programming Language by poulpy123 on Sunday March 30, 2025 @05:24AM (#43522729)
which culture and why it cased problems ? honest question, I barely heard of elm
Re:Koto Programming Language by pmarreck on Sunday March 30, 2025 @07:46AM (#43523368)
FYI roc is in the early stages of a complete rewrite from Rust to Zig and... that may take a while. I'm messing with Nim in the meantime for some commandline tooling
Re:Koto Programming Language by rTX5CMRXIfFG on Saturday March 29, 2025 @09:45AM (#43515492)
I'm not sure what you're getting at here but none of the features you mentioned are groundbreaking anymore? At least in Swift:

result/sum types = enums whose cases have associated values

inferred typing = Swift "type inference"

Not object oriented or overly prescriptive with functional programming. = Uh, yes

Those features map to Kotlin too

Re:Koto Programming Language by fstarship on Saturday March 29, 2025 @10:07AM (#43515655)
I am aware of 3 “rust inspired scripting” languages that have dynamic types.

Rhai Rune Dyon

Mun is not dynamic, however it does not have string support afaik.

Kotlin and Swift may be better candidates than these scripting languages for my imagined usecase.

Come to think of it, maybe I don’t have a point other then there is so many scripting language’s inspired by rust that is dropping a major convenience feature, that I am surprised is negotiable (inferred typing ).

Re:Koto Programming Language by zozbot234 on Saturday March 29, 2025 @11:45AM (#43516401)
Rust itself has dynamic types via the Any trait and &dyn Any variables. They are not the default of course, but they're available should you really want them. IIRC C# works similarly, only its feature is called Dynamic instead, or something like that.
Re:Koto Programming Language by skitter on Saturday March 29, 2025 @12:59PM (#43516876)
They're rather different: In Rust types only exist at compile time; dyn Any is a normal trait object, so you can only call the trait's methods. With C#'s dynamic, you can call arbitrary methods and access any fields with type checking of those accesses being delayed until runtime, which works because types exist at runtime too.

Rust's dyn Any corresponds better to C#'s Object; dynamic exists to interface with dynamic languages and is rarely used.

Re:Koto Programming Language by sanderjd on Saturday March 29, 2025 @09:55AM (#43515573)
Yeah I think Kotlin is quite close to the OP's description. But it is perhaps more focused on object orientation than they would like, and also only runs on the JVM.

But if I were to create a self-contained (that is, non-JVM) "Rust-like but with GC", I think it would look a lot like Kotlin.

Re:Koto Programming Language by karmakaze on Saturday March 29, 2025 @10:10AM (#43515689)
I haven't tried it but Kotlin/Native targets platforms like iOS, macOS, Linux, Windows, etc. There's also Kotlin/JS for JavaScript, and a WASM target with limitations.
Re:Koto Programming Language by lolinder on Saturday March 29, 2025 @10:22AM (#43515800)
It's been a few years since I tried Kotlin/Native but even then it was pretty good.
Re:Koto Programming Language by sanderjd on Saturday March 29, 2025 @11:25AM (#43516264)
Neat. I didn't know that.
Re:Koto Programming Language by valenterry on Saturday March 29, 2025 @10:39AM (#43515936)
Rather Scala but leaving out a few parts. Kotlin is very very OOP focussed and comes with a lot of baggage from Java.

Rust-like but with GC is already Scala. The reason is that Scala (unlike Kotlin) focusses on immutability, which makes it more similar to Rust. It's actually even easier to use (no borrow checker) but at the cost of performance.

After Rust, I would see F# as the next closest language, quite far before Kotlin.

Re:Koto Programming Language by sanderjd on Saturday March 29, 2025 @11:24AM (#43516259)
> Rust-like but with GC is already Scala.

Maybe like a third of Scala. But yeah, Scala has a lot of good parts, it's also just a huge surface area. I agree that you could pluck a subset out of Scala and make it this "Rust-like but with GC" language.

But it's nigh-impossible to actually make that "only use this subset" idea work in practice, because it just ends up being a bikeshed.

But you're right that the same can be said of the OO focus of Kotlin.

Re:Koto Programming Language by valenterry on Saturday March 29, 2025 @10:44PM (#43520792)
I think it absolutely works in practice. You have to pick the right libraries though. I would start with https://github.com/com-lihaoyi which basically follows that style.

> But you're right that the same can be said of the OO focus of Kotlin.

The difference is that Scala focuses on immutability, which makes the experience much closer to Rust than to Java. Whereas Kotlin does it exactly like Java does. Were Kotlin to focus on immutability like Scala does, than I would recommend Kotlin over Scala for what OP asked for.

Re:Koto Programming Language by Mawr on Sunday March 30, 2025 @07:49AM (#43523379)
A language is a shared way to communicate. If you start picking and choosing the parts of a language you like, you can no longer communicate effectively with the rest of its speakers, er, coders.

That's why C++ is so badly designed, you can do anything in it, so people do and no two C++ codebases are the same. Your codebase at work is written one way, the libraries it uses in another, your personal projects use something else entirely. It's a huge mess where nothing is compatible with each other and the mental load of switching between projects is untenable.

Re:Koto Programming Language by valenterry on Sunday March 30, 2025 @11:03AM (#43524737)
That's kind of true, but it's not black and white.

For example, look at Golang. The syntax is very plain and it's by design so that everything looks the same.

Then take a look at Lisp. On the surface the syntax looks all the same but in reality, everyone can write their their own macros and people usually do. Then, you can barely understand what's going on if you are new to the codebase - but on the other hand, the flexibility is enormous.

Scala is somewhere in between. When you hire someone for Golang, you don't really need to make anything clear in terms of code style (I believe). In Scala (or Lisp) you should definitely clarify the style that you use. It's actually normal (I've hired pretty big number of Scala developers over my career and I have also rejected job offers due to the style the company uses which doesn't match what I like).

C++ probably is alike, but I don't really any C++ experience.

Re:Koto Programming Language by sanderjd on Sunday March 30, 2025 @12:03PM (#43525180)
Scala is a lot more like lisp in this way (or actually, the C++ comparison is the much better one) than it is like go.

There are lots of ways to write Scala, to its detriment.

This isn't meant as a knock on Scala! It's a great language and in particular I think it's been influential on other newer languages. It's just that it does have this "multiple dialects" issue.

Re:Koto Programming Language by madeofpalk on Saturday March 29, 2025 @10:20AM (#43515775)
I don't think you're disagreeing with parent. I also think these features are not groundbreaking and should be considered table stakes for any new/sane language.
Re:Koto Programming Language by dustbunny on Saturday March 29, 2025 @09:17AM (#43515293)
Check out Wren.

https://wren.io/

Written by Bob Nystrom, author of Crafting Interpretors.

Re:Koto Programming Language by fstarship on Saturday March 29, 2025 @09:32AM (#43515405)
Thanks for your suggestion.

At first glance it appears to be object oriented, which is against preference but not a deal breaker.

However error case looks to be try catch which is a deal breaker.

Re:Koto Programming Language by pansa2 on Saturday March 29, 2025 @10:07AM (#43515658)
> However error case looks to be try catch which is a deal breaker

Wren uses coroutines ("fibers") for error handling, which is unusual. But yes, ultimately it does seem to be equivalent to try-catch.

Re:Koto Programming Language by pansa2 on Saturday March 29, 2025 @10:04AM (#43515633)
Wren is dynamically-typed, though
Re:Koto Programming Language by sramsay on Saturday March 29, 2025 @10:05AM (#43515643)
Last release was four years ago.
Re:Koto Programming Language by dustbunny on Saturday March 29, 2025 @07:45PM (#43519781)
Last commit was 3 weeks ago...

Besides, it's "done" let it be done.

Re:Koto Programming Language by oDot on Saturday March 29, 2025 @09:17AM (#43515297)
You're describing Gleam

https://gleam.run

Re:Koto Programming Language by IshKebab on Saturday March 29, 2025 @10:23AM (#43515803)
Can you easily embed it though? Looks like it depends on Erlang which means the answer is likely no.
Re:Koto Programming Language by oDot on Saturday March 29, 2025 @10:27AM (#43515837)
It also compiles to Javascript, which runs in a lot of places (to say the least). For WebAssembly, see my other comment about Porffor
Re:Koto Programming Language by IshKebab on Saturday March 29, 2025 @11:36AM (#43516340)
Javascript isn't the nicest thing to embed either tbh. It looks like a nice language but it's clearly not in the same space as Lua or Rhai.
Re:Koto Programming Language by fstarship on Saturday March 29, 2025 @09:38AM (#43515441)
Thanks looks great so far.

Also has pattern matching which I should also have mentioned in my top level post.

Re:Koto Programming Language by oDot on Saturday March 29, 2025 @09:45AM (#43515493)
I use it in production[0] and it's a delight so far. When Porffor[1] is ready you could compile to WASM through JS for self-contained binaries!

[0]: https://blog.nestful.app/p/why-i-rewrote-nestful-in-gleam

[1]: https://porffor.dev/

Re:Koto Programming Language by macintux on Saturday March 29, 2025 @09:41AM (#43515454)
After learning Erlang, it was painful to go back to any language which didn’t offer pattern matching. Such a great language feature.
Re:Koto Programming Language by IshKebab on Saturday March 29, 2025 @10:20AM (#43515776)
I totally agree. I think it's simply because most of these projects are pretty much one-man efforts and implementing static typing is a lot more effort than dynamic typing.
Re:Koto Programming Language by letmeinhere on Saturday March 29, 2025 @09:38AM (#43515437)
For one thing, inferred types may feel easy to use when implemented (well) but they are not easy to implement.
Re:Koto Programming Language by haxiomic on Saturday March 29, 2025 @10:06AM (#43515651)
Haxe is the best fit for me, think of typescript with functional patterns and inferred typing. Written in ocaml and inspired by the language
Re:Koto Programming Language by notnullorvoid on Saturday March 29, 2025 @10:34AM (#43515893)
> For me the biggest gap in programming languages is a rust like language with a garbage collector, instead of a borrow checker.

I agree, though I often think Rust is probably good enough. You can use RC or grab a GC crate. It's not as ergonomic as just assuming all values are GCed, but I think it gives the flexibility and fast iteration of working in a GCed language.

Re:Koto Programming Language by teleforce on Saturday March 29, 2025 @01:07PM (#43516935)
Rust is not as good as D in this domain in which D is designed for this, since it's GC by default, please see my other comments.
Re:Koto Programming Language by chris_pie on Saturday March 29, 2025 @10:05AM (#43515640)
I'd say F# is closer to filling that gap than OCaml. It's a bit less insistent on being functional and has a more familiar syntax. I find it more practical in general.
Re:Koto Programming Language by ossopite on Saturday March 29, 2025 @10:21AM (#43515785)
I'm curious what you have in mind when it comes to ways in which OCaml is insistent on being functional while F# isn't. After all, OCaml has mutable data structures, mutable record fields, for loops and so on. Is it just that more libraries assume immutability and use functional abstractions?
Re:Koto Programming Language by chris_pie on Saturday March 29, 2025 @03:36PM (#43518003)
To be fair, my knowledge of F# is a bit superficial, but I meant stuff like classes (including abstract ones), interfaces, and the ingrained interop with C#.
Re:Koto Programming Language by pjerem on Saturday March 29, 2025 @10:21AM (#43515777)
I somehow discovered F# by accident and it’s really an hidden gem.

Its ahead of its time in basically every aspect, it’s 100% compatible transparently with the whole C# ecosystem, it’s mature yet still evolving.

The type system is something I never saw before : creating types is so ergonomic and fast that you can create custom type for basically any value of your program without boilerplate if you want.

It’s really a refreshing language that anyone should try.

What I really love with it is that it’s hard to write (when you are learning it) but incredibly clear to read.

Re:Koto Programming Language by chris_pie on Saturday March 29, 2025 @03:40PM (#43518031)
Also the Units of Measure are a great feature. I think they're a zero-cost abstraction that Rust users love to mention.
Re:Koto Programming Language by valenterry on Saturday March 29, 2025 @10:40AM (#43515942)
You are looking for Scala or F#, depending on your choice of ecosystem.

Both come with very powerful features, but you don't need to use them and you can use libraries accordingly. Especially Scala can be made to feel very similar to python

Re:Koto Programming Language by camdenreslink on Saturday March 29, 2025 @10:15AM (#43515731)
You could probably write F# in the style that you describe (it is a descendant of OCaml).
Re:Koto Programming Language by simon_void on Saturday March 29, 2025 @12:31PM (#43516687)
check out Borgo https://github.com/borgo-lang/borgo It is Go with algebraic datatypes!
Re:Koto Programming Language by beagle3 on Saturday March 29, 2025 @12:40PM (#43516746)
You are describing Nim.
Re:Koto Programming Language by mirekrusin on Saturday March 29, 2025 @12:41PM (#43516756)
MoonBit lang is probably closer. Beautiful language.
Re:Koto Programming Language by teleforce on Saturday March 29, 2025 @12:47PM (#43516807)
>For me the biggest gap in programming languages is a rust like language with a garbage collector, instead of a borrow checker.

I cannot agree more that's the much needed sweet spot/Goldilock/etc. Personally I have been advocating this approach for some times. Apparently the language is already widely available and currently has stable and wide compiler support including the venerable GNU compiler suite (GDC). It also one of the fastest, if not the fastest programming in existence for both compilation and execution [1].

It has been beating Fortran in its number crunching territory, no small feat given the Fortran pedigree with many languages still depending on Fortran based infrastructure for their number crunching capabilities including Matlab, Julia, Rust, Go, C, C++, etc [2].

It also has a nice bulti-in REPL system due to its very fast compilation and execution [3].

For an excellent overview of D programming language please check this presentation at ACCU conference [4].

[1] D website:

https://dlang.org/

[2] Numeric age for D: Mir GLAS is faster than OpenBLAS and Eigen:

http://blog.mir.dlang.io/glas/benchmark/openblas/2016/09/23/...

[3] Why I use the D programming language for scripting (2021):

https://news.ycombinator.com/item?id=36928485

[4] How DLang Improves my Modern C++ and Vice Versa - Mike Shah - ACCU 2024:

https://youtu.be/CnKsOak0DHU

Re:Koto Programming Language by nine_k on Saturday March 29, 2025 @12:58PM (#43516870)
The point of many scripting languages is quick tinkering, mucking with stuff in a REPL, on top of a complex contraption of already-live objects. This works well with duck typing. It does not work with nice static type inference, because once you change something high upstream, it potentially invalidates everything downstream, your entire current session you've spent an hour building.

"Everything should be built top-down, except for the first time" (See #15 in https://www.cs.yale.edu/homes/perlis-alan/quotes.html)

Re:Koto Programming Language by sparkie on Saturday March 29, 2025 @03:01PM (#43517680)
> I don’t understand why…

Because dynamic typing has its own advantages, which are worthy of experimentation even if you perceive absence of static typing as a weakness.

Gradual typing can offer us the benefits of both worlds.

> inferred typing is nearly as easy to use while being more robust.

Implementing type inference can be fairly trivial if your types are all disjoint. Hindley-Milner type inference is well studied and there's plenty of literature.

But as soon as you introduce subtyping, the traditional methods are not sufficient. It's only in the past decade that good solutions have been discovered, notably Dolan & Mycroft's MLsub[1], based on Dolan's Algebriac Subtyping thesis[2], and Parreaux & Chau's MLstruct[3], which uses a boolean algebra approach[4]. Type inference with subtyping is not a solved problem - these developments are big steps forward, but there are still open problems under research.

Subtyping doesn't imply object-oriented. Structural typing (ie "static duck typing") is a form of subtyping.

[1]:https://github.com/stedolan/mlsub

[2]:https://www.cs.tufts.edu/~nr/cs257/archive/stephen-dolan/the...

[3]:https://github.com/hkust-taco/mlstruct

[4]:https://dl.acm.org/doi/pdf/10.1145/3563304

Re:Koto Programming Language by zozbot234 on Saturday March 29, 2025 @03:27PM (#43517906)
> Gradual typing can offer us the benefits of both worlds.

Gradual typing has much the same overhead as other kinds of dynamic typing. It's broadly appropriate as part of the interface between separately-developed software components, and not very much otherwise.

Re:Koto Programming Language by sparkie on Saturday March 29, 2025 @03:34PM (#43517974)
Gradual typing is static typing augmented with a known static type `dynamic`, and some rules by which conversions to/from `dynamic` are statically checked, called consistency.

A program in a gradually typed language which does not use `dynamic` is fully statically checked and has no overheads. The overheads only appear when `dynamic` is used.

This is why it offers the best of both worlds. We get static typing everywhere where we're not using dynamic, and when we do use dynamic, we can basically use it however we want and have the benefits of dynamic typing, because from the static perspective, dynamic ~ dynamic, regardless of what the runtime type is.

The important innovation is that consistency (~) is not transitive - so it doesn't allow us to implicitly convert one type to another - only conversions to/from dynamic are implicit, and other conversions must be done explicitly.

Obviously, this provides an "escape hatch" from static typing where we do use it - we can get around some static type check by casting to/from dynamic explicitly, but this works out well in practice.

C# is an example of a gradually typed language since v4 which introduced `dynamic`.

Haskell is close , in that it has the type `Data.Dynamic`, but it doesn't support implicit conversions to/from it, which would be possible if it had a consistency rule. We have to do the conversions explicitly.

https://jsiek.github.io/home/WhatIsGradualTyping.html

Re:Koto Programming Language by amedvednikov on Saturday March 29, 2025 @03:16PM (#43517814)
> For me the biggest gap in programming languages is a rust like language with a garbage collector, instead of a borrow checker.

https://vlang.io

GC, sum types, result/option types, interfaces, no OOP, fast compilation.

Re:Koto Programming Language by egl2020 on Saturday March 29, 2025 @03:38PM (#43518019)
> I don't understand why.

Favors minimal text entry. You keep the type information in your head and enter fewer tokens. Historically you also reduced the work and improved responsiveness for the interpreter, which might have been running on an 8- or 16-bit computer at 5 MHz.