knuth-literate-programs VS TypeScript

Compare knuth-literate-programs vs TypeScript and see what are their differences.

knuth-literate-programs

Examples of literate programming by Knuth (by shreevatsa)

TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output. (by microsoft)
Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
knuth-literate-programs TypeScript
1 1,305
34 97,944
- 1.0%
6.2 9.9
11 months ago 3 days ago
CWeb TypeScript
- Apache License 2.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

knuth-literate-programs

Posts with mentions or reviews of knuth-literate-programs. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2020-12-30.
  • Professor Donald Knuth on Writing and More, an Interview [pdf]
    4 projects | news.ycombinator.com | 30 Dec 2020
    So with that understanding in the comment above, I think one is supposed to glean that the following is the structure of the ADVENT program (http://literateprogramming.com/adventure.pdf or download from https://github.com/shreevatsa/knuth-literate-programs/blob/m... for working hyperlinks):

    - In "Introduction" (sections 1–3), the program's overall outline is given,

    - In "The Vocabulary" (sections 4–17), we have data structures for storing words (the hash table), how they map to motions and objects and other responses from the program,

    - In "Cave Data" (sections 18–20) there are the 100+ locations one can be in during the game,

    - In "Cave Connections" (sections 21–62) there's the game's "map" data: how you get around, what messages you get, etc,

    - In "Data structures for objects" (sections 63–68), there's data structures for the list of (game) objects at a given location, for groups of objects, and object properties (like its name and in-game note),

    - In "Object data" (sections 69–70) these are populated,

    - "Low-level input" (sections 71–73), is just asking yes/no questions and taking in commands,

    - The next chapter, "The main control loop" (sections 74–91) begins with some comments very revealing about the author's programming style / thinking:

    > Now we’ve got enough low-level mechanisms in place to start thinking of the program from the top down, and to specify the high-level control. […] Here is our overall strategy for administering the game. […] The execution consists of two nested loops: There are “minor cycles” inside of “major cycles.” Actions define minor cycles in which you stay in the same place and we tell you the result of your action. Motions define major cycles in which you move and we tell you what you can see at the new place.

    etc. And this chapter, in turn using many of the following ones, is what populates one of the main sections that were mentioned in the outline of the program on Page 2. There's parsing of the user's input, dealing with edge cases, until we figure out where to `goto`.

    - The next chapter, "Simple verbs" (sections 92–103) starts with “Let’s get experience implementing the actions by dispensing with the easy cases first” i.e. it's the start of several chapters implementing the action procedures we invoke (or to which we "goto") from the previously mentioned main control loop.

    - The next chapter, "Liquid assets" (sections 104–115) starts with something that I also find revealing: "Readers of this program will already have noticed that the BOTTLE is a rather complicated object, since it can be empty or filled with either water or oil" (so he expects that your reading will have noticed this already?)

    - Then "The other actions" (sections 116–139) is what you'd expect: "Now that we understand how to write action routines, we’re ready to complete the set" (must say, this whole game looks a lot of fun! Thanks Crowther and Woods!)

    - Then "Motions" (sections 140–153) (filling out a section referred to in the main control loop above), "Random Numbers" (sections 154–158, half a page), "Dwarf stuff" (sections 159–176), "Closing the Cave" (177–182), and "Death and Resurrection" (183–192), "Scoring" (193–199), and "Launching the program" (section 200).

    Well, with my hard-won familiarity with WEB/CWEB conventions (I bet you didn't expect the table of contents to be on the last page) and with Knuth's style (there's often a main control loop branching off to various action procedures), the above was what I understand of the overall structure of the program, and it took me about a second or two per page, maybe a bit more here and there, less than five minutes overall. But now I feel oriented enough that I can now understand the program as a whole, and I think literate programming (though I haven't even started actually reading it!) makes the program more helpful than if it was written in "for the compiler" order with the same soup of functions and gotos. But to reiterate, this is about better presentation of programs written in straightforward "just tell the computer what to do" style. It is conceivable that with modern programming conventions, with just the right abstractions and objects and whatnot, one could produce something more readable. But that's not relevant here, I think (and besides maybe that program too could be reordered, written literately?)

    Now, one could ask: why doesn't Knuth just write out this outline at the beginning? Why is the heart of how the program works, the main control loop, mentioned neither at beginning nor end but in the middle of the book, section 74 of 200? Is it fair to the reader to have so many conventions that are not explained in the program itself? Well, I have no end of frustrations with trying to read Knuth's literate programs (see my complaints and jokes in the page I linked above and in the slides), but still I think the answer would be: (1) Every house style has its conventions that must be learned (like: "variables ending with an underscore are private member variables in this codebase"), (2) It would be extra work to write this all out when the reader can just skim and find out, and for Knuth, literate programming (and programming in general) is supposed to be fun, not drudgery. So while I think Knuth-style literate programming has problems, I think the more interesting problems are not the surface-level ones.

TypeScript

Posts with mentions or reviews of TypeScript. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-04-25.
  • JSR Is Not Another Package Manager
    2 projects | news.ycombinator.com | 25 Apr 2024
    Regular expressions are part of the language, so it's not so unreasonable that TypeScript should parse them and take their semantics into account. Indeed, TypeScript 5.5 will include [new support for syntax checking of regular expressions](https://github.com/microsoft/TypeScript/pull/55600), and presumably they'll eventually be able to solve the problem the GP highlighted on top of those foundations.
  • TypeScript Essentials: Distinguishing Types with Branding
    2 projects | news.ycombinator.com | 24 Apr 2024
    Dedicated syntax for creating unique subsets of a type that denote a particular refinement is a longstanding ask[2] - and very useful, we've experimented with implementations.[3]

    I don't think it has any relation to runtime type checking at all. It's refinement types, [4] or newtypes[5] depending on the details and how you shape it.

    [1] https://github.com/microsoft/TypeScript/blob/main/src/compil...

  • What is an Abstract Syntax Tree in Programming?
    13 projects | dev.to | 5 Apr 2024
    GitHub | Website
  • Smart Contract Programming Languages: sCrypt vs. Solidity
    2 projects | dev.to | 5 Apr 2024
    Learning Curve and Developer Tooling sCrypt is an embedded Domain Specific Language (eDSL) based on TypeScript. It is strictly a subset of TypeScript, so all sCrypt code is valid TypeScript. TypeScript is chosen as the host language because it provides an easy, familiar language (JavaScript), but with type safety. There’s an abundance of learning materials available for TypeScript and thus sCrypt, including online tutorials, courses, documentation, and community support. This makes it relatively easy for beginners to start learning. It also has a vast ecosystem with numerous libraries and frameworks (e.g., React, Angular, Vue) that can simplify development and integration with Web2 applications.
  • Understanding the Difference Between Type and Interface in TypeScript
    1 project | dev.to | 2 Apr 2024
    As a JavaScript or TypeScript developer, you might have come across the terms type and interface when working with complex data structures or defining custom types. While both serve similar purposes, they have distinct characteristics that influence when to use them. In this blog post, we'll delve into the differences between types and interfaces in TypeScript, providing examples to aid your understanding.
  • Type-Safe Fetch with Next.js, Strapi, and OpenAPI
    8 projects | dev.to | 2 Apr 2024
    TypeScript helps you in many ways in the context of a JavaScript app. It makes it easier to consume interfaces of any type.
  • Proposal: Types as Configuration
    1 project | news.ycombinator.com | 1 Apr 2024
  • How to scrape Amazon products
    4 projects | dev.to | 1 Apr 2024
    In this guide, we'll be extracting information from Amazon product pages using the power of TypeScript in combination with the Cheerio and Crawlee libraries. We'll explore how to retrieve and extract detailed product data such as titles, prices, image URLs, and more from Amazon's vast marketplace. We'll also discuss handling potential blocking issues that may arise during the scraping process.
  • Shared Tailwind Setup For Micro Frontend Application with Nx Workspace
    6 projects | dev.to | 29 Mar 2024
    TypeScript
  • Building a Dynamic Job Board with Issues Github, Next.js, Tailwind CSS and MobX-State-Tree
    6 projects | dev.to | 28 Mar 2024
    Familiarity with TypeScript, React and Next.js

What are some alternatives?

When comparing knuth-literate-programs and TypeScript you can also consider the following projects:

nestor - A parallel implementation of NESTOR in Python 3

zod - TypeScript-first schema validation with static type inference

Flutter - Flutter makes it easy and fast to build beautiful apps for mobile and beyond

Tailwind CSS - A utility-first CSS framework for rapid UI development.

zx - A tool for writing better scripts

esbuild - An extremely fast bundler for the web

gray-matter - Smarter YAML front matter parser, used by metalsmith, Gatsby, Netlify, Assemble, mapbox-gl, phenomic, vuejs vitepress, TinaCMS, Shopify Polaris, Ant Design, Astro, hashicorp, garden, slidev, saber, sourcegraph, and many others. Simple to use, and battle tested. Parses YAML by default but can also parse JSON Front Matter, Coffee Front Matter, TOML Front Matter, and has support for custom parsers. Please follow gray-matter's author: https://github.com/jonschlinkert

Yup - Dead simple Object schema validation

Quasar Framework - Quasar Framework - Build high-performance VueJS user interfaces in record time

rescript-compiler - The compiler for ReScript.

linaria - Zero-runtime CSS in JS library

fp-ts - Functional programming in TypeScript