alantech / alan

Autoscalable Programming Language
https://alan-lang.org
MIT License
305 stars 10 forks source link

Implement map for the Buffer type #789

Closed dfellis closed 1 month ago

dfellis commented 1 month ago

This one took a while to do because it uncovered issues with the type inference as written; it was accepting garbage because I had blurred two different ways of inferring it in my head to resolve the AnyOf type, and it only worked accidentally before.

It also took some time because the way it was constructing an array (equivalent to buffers in Alan/JS/etc) in Rust was incorrect and I was getting really weird Rust compilation errors about fn items instead of fn pointers due to that. (Which might point at a bug in the Rust compiler, because it apparently had no problem creating an array of mutable pointers to constant integers, which is nonsensical.)

I realized that I had forgotten to create a task to make sure that most of the Array methods are also implemented for Buffers, and that's what this is about.