Project abandoned? #84
Replies: 3 comments 8 replies
-
It's indeed a cool project |
Beta Was this translation helpful? Give feedback.
-
Hey all, it's definitely not abandoned! There are aspects of the language I'd like to refine further (like lifetimes, interior mutability, async, macros) and I feel I need to spend more time with Rust to understand why Rust made the language design decisions in the way that it did. As you can imagine, it's a big undertaking to write a programming language. That said, I genuinely believe that a language which offers the core benefits of Rust through a familiar, simple, expressive syntax will be a productive environment for user-space applications - like desktop gui apps, wasm gui apps, web servers/APIs, perhaps even bundlers. I'm happy for more experienced language designers to contribute their thoughts and raise PRs in the interim! The basic mission statement is "what are the minimum changes required to TypeScript to have it support a borrow checker". Along the way we'd need to pull out some of JavaScript's quirks, leaning out TypeScript in the process - so on the other hand, what are the features from TypeScript to keep? === unimportant brain dump below For instance, when you import a module in TS, it's allowed to run code on the top level at the time of importing. This complicates the handling of modules - particularly during build optimization - and can actually introduce performance overhead associated with importing modules - so that will have to go. What about the Structural types and algebraic types (like function foo(bar: string | undefined) {
if (bar === undefined) return
console.log(bar) // compiler knows this is now string
} However that implies a more imperative style of programming that is in contrast with Rust's preference for using fn foo(bar: Option<i32>) {
match bar {
None => {},
Some(value) => { print!("{}", value) },
}
} Then if you think about it, Rust's enum is trying to solve the same problem that TypeScript solves with structural types and type elimination - so do we need enums in the same form we see in Rust? A It's quite interesting finding the intersection between the two languages, but again, I am trying to learn more about |
Beta Was this translation helpful? Give feedback.
-
Hey all, update. I've been working with Rust professionally for the last year and it's really helped me get an understanding for how its ideas could be applied to a simplified language. I still think there is a need for a language like Rust with a simplified syntax - particularly when it comes to async code. Simplifying the language would come at a performance cost as it would rely more heavily on dynamic data structures. Things I have been thinking about: Lifetimes Lifetimes are particularly difficult to translate and I think it would be wise to exclude them. I can use compiler magic to automatically wrap values in smart pointers when the compiler detects they are needed. Essentially, automatically converting values to be reference counted when the compiler detects they need to be - like this: async function main() {
const foo = "hi"
const p1 = (async [clone foo]() => {
console.log(foo)
})()
const p2 = (async [clone foo]() => {
console.log(foo)
})()
await Promise.all([p1, p2])
} Where the compiler automatically makes Async This is such a tricky problem to solve. Rust is very picky with its Futures and I'd like to avoid Having the async runtime built into the standard library makes sense for this, making that configurable is an interesting challenge. Go uses environment variables to control the behaviour of it's async runtime - but that requires shipping the entire runtime even if you only use a single threaded event loop. There are also cases where you might want to have the application explicitly define a single threaded event loop as the behaviour may depend on that. Other cases where you might want multiple/separate runtimes, and cases where you might explicitly want OS threads.
Rust has support in its type system for types that can be sent across threads, run once in a callback, run multiple times - etc. I find this concept to be super powerful and have yet to determine how that fits into the vision of our language. FFI Super important for me is a quality FFI to ensure interoperability with C libraries. What that looks like is still up for grabs. Closing thoughts My day job has been to work on a Rust JavaScript bundler so I have been learning a lot about compilers. I'm feeling pretty confident that I could write a basic compiler for BorrowScript that could build some basic examples. I'm not sure how to target LLVM, though I could certainly output C and compile that with gcc (at least in the initial stages) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Just heard about BorrowScript today and read the readme and got really excited. Always wanted a language that combined the ease of use of TypeScript with the performance and safety guarantees of Rust.
But then I realized there's been no activity for a good amount of months. Is it safe to assume that this idea has been abandoned?
Beta Was this translation helpful? Give feedback.
All reactions