Pages

27 September 2011

Simulation is Abstraction is Power

A more abstract programming language is more powerful. This is one of precious few things that most software developers agree on. C is more powerful than assembly, C++ is more powerful than C, and Lisp is more powerful than most developers realise—or will ever take advantage of. And that’s fine.

But whence cometh abstraction? Sure, you can say that all abstractions are generalisations of some category of operations or structures, but that’s shallow and basically useless. There’s more to it.

Abstraction comes from simulation. Computers run simulations of idealised computation; more abstract languages are better at simulating the ideal. Low-level languages deal with real hardware, while high-level languages simulate ideal hardware. A few examples:

  • References simulate unstructured memory.
  • Garbage collection simulates unbounded memory.
  • Dynamic typing simulates lack of typing.
  • Threads simulate parallel execution.
  • Tail recursion simulates unbounded recursion.

(Depending on how far you want to go with the analogy, recursion simulates a whole bunch of things, including self-reference, fractal structure, and induction.)

Simulation is about removing dependency. A program can depend on manual memory management, but it cannot, by definition, depend on garbage collection. With memory management fully abstracted away, memory management ought to be a nonexistent concept from the perspective of the language.

Your program probably pretends it has infinite memory anyway. Provided your program doesn’t crash, the system does have unbounded memory as far as you know. Most programs that are working properly don’t run out of memory unless they’re deliberately designed to, for lack of a better phrase, fuck shit up.

Similarly, as we all know, threads may actually run on separate cores, and thus truly in parallel—that’s sorta the point. But the thing about a language that offers powerful abstractions for parallelism is that you don’t need to care. It’s taken care of. As far as you need to know, the system can perform an infinite number of computations at once.

Abstractions are (imperfect) simulations of limitlessness. As a language designer, you can (and should) offer pragmatic limitations and safeguards for the benefit of the fallible developer. But to make a more powerful language, you must remove limitations. When you do so, you discover the nature of the underlying simulation—and simulation is abstraction is power.

8 comments:

  1. "C is more powerful than assembly, C++ is more powerful than C, and Lisp is more powerful than most developers realise"

    I do not think there is better language than the other. Some people prefer to work with C instead of C++.

    ReplyDelete
    Replies
    1. I didn’t say “better”, I said “more powerful”. Power isn’t the only thing at play when you’re choosing a language for a project—libraries, interoperability, performance, and yes, personal preference are all important factors as well.

      Delete
  2. Thank you for your reasonable point.My neighbor and I were getting ready to start researching this.I came from my local library, but now I can see it well here. I kicked my butt.I'm glad you can freely share such wonderful information outside.

    바카라사이트

    안전놀이터

    스포츠토토핫

    토토사이트

    토토

    바카라사이트

    ReplyDelete

  3. I would appreciate you that you pick up an important topic to write a thoroughly informative post on. I hope that you never stop and keep posting such valuable content Pacman 30th Anniversary

    ReplyDelete
  4. This website really has all the information I needed concerning this subject and didn’t know who to
    ask

    ReplyDelete
  5. Everything is very open with a really clear description of the challenges. It was definitely informative. Your site
    is useful.

    ReplyDelete
  6. It is very well written, and your points are well-expressed. I request you warmly, please, don’t ever stop writing.

    ReplyDelete
  7. Thank you for sharing this incredible blog post. It's genuinely a delightful and captivating read. Please keep the posts coming; we're eagerly looking forward to more. If you're dealing with finance assignments, your quest concludes right here. We offer high-quality assistance to students in need of help with their Finance Assignment Help. Our experts possess a profound understanding of the field, ensuring the delivery of top-notch work within the specified deadline. Whether you need help with calculations, analysis, or any other aspect of finance assignments, we're here to provide expert guidance. Explore our Finance Assignment Help services for unparalleled support in mastering your finance coursework.






    ReplyDelete