4 ms·
I’ve been working on a concatenative language, Kitten, which I hope eventually bridges the gap to more mainstream programmers with a seamless blend of functiona
by evincarofautumn 8y ago
I’ve been working on a concatenative language, Kitten, which I hope eventually bridges the gap to more mainstream programmers with a seamless blend of functional and imperative semantics, useful language features that work best in a concatenative setting, and straightforward reasoning about correctness and performance.
Kitten is small, but not nearly as minimalistic as other concatenative languages—while it’s meant to be a “systems” language in the realm of C++ or Rust—with unboxed data types by default and no GC required—there are various concessions for usability like a traditional tokenizer, local variables, infix operators, an expressive static type system similar to Haskell, and a compositional effect/coeffect system.
Moreover, thanks to static types, thinking of the program in terms of a “data stack” is somewhat discouraged—instead of stack shuffling operations, it encourages the judicious use of local variables and dataflow combinators (e.g., patterns like “apply a function to two values and get both results”). The stack isn’t even really an implementation detail: no stack is actually present in memory at runtime in the latest iteration of the compiler, since data lives in registers or on the call stack, just like in C.
Anyway, in the meantime, you can toy around with an existing concatenative language like Factor, which feels very Lisp-like and has a Smalltalk-like object system and nice interactive environment; or you can get many of the benefits of concatenative programming by preferring a compositional/dataflow style (not necessarily stack-oriented) in languages where it’s reasonably easy, such as Haskell and Clojure.
- exikyut 8y agoHmm, interesting. I just had a slow look through http://kittenlang.org/intro/ http://kittenlang.org/intro/. In all honesty my stupid ADHD decided to conk out precisely at the Lambdas section, I'm not sure why. Up to that point, the only thing that I'd note is that "match (xs head)" is not described anywhere (on the page at all). But I think it's interesting you posit Kitten as a systems language. Huh. (What's a "traditional" tokenizer?! Ah; I assume you mean "not pure Forth" as opposed to "buy APL keycaps here" (heh).) I guess the only advice I can think of right now is, offer batteries included, and include the batteries you're most passionate about, because it'll mean the implementations are complete and well-tested. If that's web templating (random top-of-my-head thought), do that; if it's image processing, do that. It'll raise the chances the language becomes $thing-heavy because nobody contributes other code, but you can always stop advertising and spend time rounding things out if that happens. I meant to install Kitten, but that didn't quite work this time around due to problems on my end. (First git was silently segfaulting due to inconsistently-upgraded shared libraries on my Slackware box, then I realized I needed Haskell and switched to Arch, then I was reminded that pacman doesn't really know how to resolve dependencies properly ("if you install something that needs the newest version of glibc, maybe I shouldn't need to have to upgrade glibc (and reverse-resolve its dependencies) myself?!"), then after half-installing Haskell I discovered (/) only had 19MB free, so now I have to go figure out what caused that... (I argue it's my 80KB/s ADSL2+ upload speed :P)) I'll definitely be looking at Kitten at some point though. Thanks for the reply! EDIT: Got past the previous issues, now Haskell is sad. https://github.com/evincarofautumn/kitten/issues/206 https://github.com/evincarofautumn/kitten/issues/206
- evincarofautumn 8y ago> "match (xs head)" is not described anywhere (on the page at all). “A ‘match’ expression takes an instance of an ADT, matches on its tag, and unpacks its fields (if any) onto the stack so they can be manipulated.” (Under the “Algebraic Data Types” section.) By a “traditional” tokenizer I mean “a tokenizer more like what you’d expect from a mainstream C-like programming language, not just splitting on whitespace like Forth does”. It has some superficial similarities to Forth (postfix by default), but overall has more in common with the ML and C families (Haskell, OCaml, Rust, C, C++). The reason I decided to start labeling it a “systems” language recently is to get the attention of the people from C++ and Rust who I’d like to try it out eventually. The implementation isn’t nearly close to this, but the language itself is designed to be easy to implement efficiently (strict evaluation, guaranteed tail call elimination, unboxed data types, no GC or nontrivial runtime required) and has a lot of static structure available for the compiler to do optimisations (static type and effect system). Kitten’s docs are perpetually in an awkward state because I’m the only one working on it regularly—they’re usually slightly behind the compiler version I’m actually working on, and occasionally describe language features that aren’t yet implementation features (i.e., they should work but are known to be buggy/incomplete in the current version). I’m focusing on the next major round of changes to the compiler, which I hope is the last before a release, and I plan to go through all the docs and flesh them out as part of the eventual release process.
- exikyut 8y ago(Sorry for late reply, woops) Hm, thanks for the manual reference (heh, should have gone and looked). Now to go figure out what "xs head" means... I think the tokenizer choices are pragmatic and interesting. They make the language less simply annoying and irritating, and thus more accessible to learn. The idea of a systems language with Kitten's focuses sounds good - oddball alternatives always serve to (slowly) influence the mainstream, let's hope that happens here :D The approach to documentation is reasonable too, if unintuitive at first glance; providing a language that implements the 95th percentile of what is advertised is actually not that bad of an approach.
- 8y ago