21 ms·
The Kitten Programming Language
- nerdponx 6y agoInteresting idea! It looks like the Git repo doesn't get many updates, at least not on the master branch. Is it "dead", or is it "stable"? Edit: it looks like as of 2018, the author was taking time off of working in tech (https://github.com/evincarofautumn/kitten/issues/201#issuecomment-379588101 https://github.com/evincarofautumn/kitten/issues/201#issueco...). Maybe lack of activity means they got another job, or maybe they left the programming/tech world entirely.
- Wowfunhappy 6y agoTheir Github avatar is wearing a facemask, which presumably means it was changed at some point in 2020...
- brundolf 6y agoI'm imagining an author who found his definition of programming nirvana, encoded it as a language, saw that he'd never actually get paid to work in that way and decided to leave it all behind and move to a cabin in the mountains
- 7thaccount 6y agoI've posted this language on HN before (a different username) and the author responded. I haven't played with it, but found the concept interesting. I'm also not sure if dead or stable are the best terms for what appears to be a hobby project and not destined to run in production. It could be neither.
- hanniabu 6y agoJust from looking at the hello world example, I don't like how "say" and "ask" are placed at the end. It would be much more readable to start with that.
- senkora 6y agoThink of it like a unix pipe. That’s what they’re going for with the concatenative paradigm.
- creata 6y agoIt's a stack-oriented language, so postfix notation kind of comes with the territory.
- 0x264 6y agoIt's stack based. Written like RPN (Reverse Polish Notation).
- zumu 6y agoThey explain this in the tutorial, but anecdotally it reads really well if you speak a SOV language.
- tom_mellior 6y agoIt's unfortunate that people are downvoting you because "that's just how it is in stack-based languages". Maybe stack-based languages are indeed less readable than alternatives. Pointing this out should ideally encourage discussion rather than downvotes. The language's developers themselves seem to agree that postfix syntax isn't always best: The syntax for the type "list of characters" is "List<Char>", which is not postfix. Compare ML-family languages, where this would use postfix syntax, writing this type as "char list".
- caslon 6y agoPostfix is incredibly intuitive. It's much simpler to read than alternatives. Your proposal is wrong.
- creata 6y ago> Maybe stack-based languages are indeed less readable than alternatives. That may be the case, but taking a core language feature and commenting "I don't like it, change it" isn't a very effective way to encourage discussion, in my opinion.
- mannerheim 6y ago> Text literals use double-quotes (""), and are syntactic sugar for lists of characters. They have type List<Char>. Perhaps not the best choice. I believe this is frequently considered a design mistake in Haskell.
- eptcyka 6y agoDepends on the underlying implementation of `List<T>`. It should be fine as long as it's not a linked list.
- mannerheim 6y agoIf I'm reading the implementation of `reverse<T>` correctly, it appears to be a linked list.
- eptcyka 6y agoYou're right, oh boy! https://github.com/evincarofautumn/kitten/blob/master/common.ktn#L1152 https://github.com/evincarofautumn/kitten/blob/master/common...
- exdsq 6y agoWhy is this an issue, out of interest? :)
- fiddlerwoaroof 6y agoRandom access is pretty common with strings, so using a datastructure that makes it expensive is problematic.
- jjnoakes 6y agoIs random access that common? I usually only iterate over strings (and random access is hard to do with utf-8 and friends). I think the two biggest reasons to not use a list of characters to represent a string are memory efficiency (not storing a linked list pointer per character) and memory locality (keeping the characters of the string near each other in memory since they are frequently used as a unit).
- creata 6y agoThe homepage says that Kitten has (will have?) memory management with no garbage collection, and yet the introduction shows that each item on the stack can represent arbitrarily large lists, trees, etc. How might this be implemented?
- rowanG077 6y agoSee the faq: http://kittenlang.org/faq/ http://kittenlang.org/faq/
- remexre 6y agoSo I'd imagine it has "linear-like" ownership?
- tom_mellior 6y agoThe FAQ says: > In addition, stack-based resource management has predictable runtime performance behavior: when you drop a value from the stack, it gets deallocated, no garbage collector required. This cannot possibly work for this language. Stack-based memory management only works as long as all references go from "newer" values (higher on the stack) to "older" ones (deeper on the stack). But this language allows you to write a function that rearranges the stack, for example by swapping the two topmost elements. Consider a scenario where some value x is on top of the stack: x Now we build some sort of heap value that has a reference to x and push it onto the stack: box(x) x Now swap these: x box(x) Then drop x from the stack, for example by printing it. This deallocates x. The stack is now: box(x) But this value is undefined, since x has been deallocated. You have a use-after-free error. I wish people stopped approaching language design from the point of view that the people who have been working on garbage collection for the last 60 years are all idiots who don't see how simple it all is.
- nerdponx 6y agoSo the runtime will just randomly segfault or cause memory corruption? That wouldn't make a very useful language, maybe they have a workaround.
- azhenley 6y agoThe author’s blog is also good, though it’s been several years since the last post: http://evincarofautumn.blogspot.com http://evincarofautumn.blogspot.com
- nickcw 6y agoLooks like Haskell dreaming of FORTH. Quite fun and surprisingly readable to this old FORTH programmer. Though List<Char> for strings had me coughing up a fur ball.
- brundolf 6y agoThe permissions system for functions looks really neat. Lately my favorite features in a language are the ones that allow you to narrow down a function's contract with the calling code in interesting ways (in fact I'm working on one right now that's built around this idea)
- kindofajsdev 6y agoI'm disappointed. I expected the syntax to be cuter.
- zumu 6y agoFor those curious, last time it was on HN https://news.ycombinator.com/item?id=13345832 https://news.ycombinator.com/item?id=13345832 The author answers some questions.
- calltrak 6y agodamm i should have wrote https://picc.io https://picc.io in kitten
- dang 6y agoIf curious, past threads: Kitten Programming Language - https://news.ycombinator.com/item?id=17681202 https://news.ycombinator.com/item?id=17681202 - Aug 2018 (13 comments) Kitten – A statically typed, stack-based functional programming language - https://news.ycombinator.com/item?id=13345832 https://news.ycombinator.com/item?id=13345832 - Jan 2017 (49 comments) Kitten: a statically-typed stack-based functional programming language - https://news.ycombinator.com/item?id=11753145 https://news.ycombinator.com/item?id=11753145 - May 2016 (1 comment) Kitten: compile to C, stack-based functional programming language - https://news.ycombinator.com/item?id=11506603 https://news.ycombinator.com/item?id=11506603 - April 2016 (3 comments) Kitten - high-performance statically typed concatenative programming language - https://news.ycombinator.com/item?id=4993640 https://news.ycombinator.com/item?id=4993640 - Jan 2013 (1 comment)
- jevgeni 6y ago> Kitten is a statically typed, stack-based functional programming language designed to be simple and fast. It's amazing how many languages are designed to be simple and fast. You'd think that at some point the design would converge...