Languages

Chapter 13 - Programming Languages #

for (πŸ₯š = 1; πŸ₯š < πŸ”; πŸ₯š++){
   //whatever
}

[TODO] talk about to why there are so many, pros & cons per domain, etc

https://esoteric.codes

Why OO Sucks (Joe Armstrong)

0-based vs. 1-based indexing (Hisham Hm)

Low Level #

C, C++, C#, ???? #

[TODO] - a lot, talk about the varieties and differences of C and C++ and C# and why thery’re good and bad, etc.

Best-of-C

Assembly #

Assembly code is specific to an Instruction Set Architecture or ISA, that means it is written for a specific family of processors. Most laptops and desktops today run on x86_64 processors made by either AMD or Intel, while most tablets and phones use processors that use ARM. Of course, there are many, many other instruction sets than these two. For example, 6502 assembly is particularly easy to write as it’s from an era (1) when programming at the assembly level was still common. On the other hand, RISC-V is a newer ISA that has been gaining a lot of traction due to it’s open nature.

x86 ASM: #

x86 Assembly: Hello World! (YouTube, John Hammond)

Say hello to x86_64 Assembly 1-8 by 0xAX

or

Let’s Learn x86-64 Assembly! Part 0 - Setup and First Steps

Part 1 - Metaprogramming in Flat Assembler

Part 2 - We’re Writing a Virtual Machine

or for the very adventurous

Linux-kernal-module-cheat [Github], has a nice guide to asm

6502 #

‘Furby’ Source Code

Rust #

Rust’s rich type system and ownership model guarantee memory-safety and thread-safety β€” enabling you to eliminate many classes of bugs at compile-time.

Basically, Rust doesn’t let you screw up. It enforces writing code that’s safe (except when you specify you want to do something unsafe). It has a lot of other really nice features and makes using efficient data structures easy. Another really nifty thing about Rust is that it has a sort of at compile time garbage collection of sorts, for lack of a better way to put it. Read more on that here.

I really recommend A half-hour to learn Rust

Nannou, is a creative coding framework for Rust that’s pretty nifty too.

To show the maturity, just check out https://www.redox-os.org/, a full OS written in Rust!

Also, it’s worth noting Rust can be used to generate Web Assembly (more about that below)

Other sources to lean rust:

You may also want to check out CXX for C++<-> Rust interop

Go #

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

The big claim to fame for go is, well go, which let’s you do really easy threading. (https://gobyexample.com/goroutines)

Other sources to learn Go:

Zig #

A general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.

https://ziglang.org/

Zig: A programming language designed for robustness, optimality, and clarity – Andrew Kelley (YouTube)

Writing a small ray tracer in Rust and Zig

A Half hour to Learn Zig (Github Gist)

Crystal #

Crystal’s big thing is a Ruby (a very fast to write language) that’s compiled and fast. From the home page:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# A very basic HTTP server
require "http/server"

server = HTTP::Server.new do |context|
  context.response.content_type = "text/plain"
  context.response.print "Hello world, got #{context.request.path}!"
end

puts "Listening on http://127.0.0.1:8080"
server.listen(8080)

Seriously check it out at https://crystal-lang.org/

D #

A lesser used competitor to C++ mostly. It’s very syntactically similar. Might be worth looking at.

https://dlang.org

Nim #

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula.

https://nim-lang.org/

Further, Nim allows for easy ‘metaprogramming’ which basically means you can [TODO]

Nim’s syntax is python-like-ish

Red #

To be honest, I’m not sure Red belongs in the low level category, as it can be ran as a JIT language.

Red is a next-gen programming language, strongly inspired by REBOL. Main features are:

  • Human-friendly syntax
  • Homoiconic (Red is its own meta-language and own data-format)
  • Functional, imperative, reactive and symbolic programming
  • Prototype-based object support
  • **Gradual and multi-**typing
  • Macros system
  • Rich set of built-in datatypes (50+)
  • Both statically and JIT-compiled to native code
  • Cross-compilation done right
  • Produces executables of less than 1MB, with no dependencies
  • Concurrency and parallelism strong support (actors, parallel collections)
  • Low-level system programming abilities through the built-in Red/System DSL
  • Powerful PEG parser DSL included
  • Cross-platform native GUI system, with a UI DSL and drawing DSL
  • Bridging to the JVM
  • High-level scripting and REPL console included
  • Visual Studio Code plugin, with many helpful features
  • Highly embeddable
  • Low memory footprint, garbage collected
  • Single-file (~1MB) contains whole toolchain, full standard library and REPL.
  • No install, no setup
  • Fun guaranteed!

https://www.red-lang.org/p/about.html

If you’re interested, check out Red’s ‘Getting Started’ page.

Haxe #

Haxe is an open source high-level strictly-typed programming language with a fast optimizing cross-compiler.

https://haxe.org/

Java & Kotlin #

!> This is Opinionated Guides, so let me be clear, I really, really hate Java. It’s a langage that didn’t even become popular on it’s own merit, instead Sun Microsystem paid a fuck ton of money to push it- hence the “3 Billion Devices Run Java” Thing. I’m hopeful (albeit probably naively) that Oracle (Which bought Java from Sun) making Java a mess of licencesing as the ‘main’ Java Virtual Machine goes paid (Read on Wikipedia) and suing Google will be the nail in the cofin for education using it and that it will die out with time. Criticism of Java (Wikipedia)

don’t. but, here’s why not to use Java:

https://jakewharton.com/shrinking-a-kotlin-binary/

WebAssembly #

WebAssembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable target for compilation of high-level languages like C/C++/Rust, enabling deployment on the web for client and server applications.

https://webassembly.org/

While not technically a programming language, I wanted to bring it up and encourage you look into it to be used instead of JavaScript for real projects.

https://www.assemblyscript.org is a TypeScript varient that can generate Web asm.

https://webassembly.studio

Vult #

Vult Language Homepage

“The Vult Language is a transcompiler to write high-performance DSP code”

Call for Contribution #

If I missed a language you think I should have mentioned or would like to write a nice guide to your language of choice to be included in this Opinionated Guide please submit a pull request. I’d love to expand the Rust, Go, and Zig sections significantly!


High Level #

[TODO] probably going to need to break this out into it’s own chapter

Python #

Cython

Cython is an optimising static compiler for both the Python programming language and the extended Cython programming language (based on Pyrex). It makes writing C extensions for Python as easy as Python itself.

JavaScript #

Fine. I’ll talk about JS. But, please. For the love of god do not use this to make an Electron App.

Before going to far, I do want to mention that a chunk of my hatred for JS is solved using frameworks and that I totally acknowledge the utility of JS for making quick, often very cool, ‘sketches’. The creative coding community is amazing. Further, JS, as much of a total dumpster fire as it is, is responsible for the Internet as it is today weather thats a good thing or not.

CoffeeScript #

https://coffeescript.org/

TypeScript #

https://www.typescriptlang.org/

Frameworks #

https://en.wikipedia.org/wiki/Comparison_of_JavaScript_frameworks

Angular #
React #
Vue #
Node #

PHP #

don’t. but, here’s why not to use PHP: If you must, you might want to check out Hack: https://hacklang.org/

Ruby #

A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.

https://www.ruby-lang.org/en/

For the Skript Kidd3s #

In programming and hacking cultures, a script kiddie, skiddie, or skid is an unskilled individual who uses scripts or programs developed by others to attack computer systems and networks and deface websites, such as a web shell. It is generally assumed that most script kiddies are juveniles who lack the ability to write sophisticated programs or exploits on their own and that their objective is to try to impress their friends or gain credit in computer-enthusiast communities. However, the term does not relate to the actual age of the participant. The term is considered to be derogatory.

from https://en.wikipedia.org/wiki/Script_kiddie

But, really, some absolutely incredible code has been written in the following languages. They more than serve their purpose and are generally some of the fastest “I just need a quick and dirty solution” options out there. Not everything needs a blazing fast hand optimized C implementation, and code that’s really just for personal use, to acomplish a one-off task, or that runs inside a bigger program (3D modeling software like Blender, Video editing software like Premier, Game development editors, etc.) should probably be easy to read and modify quickly. Rapid prototyping certainly has it’s place.

Just don’t think you should use these to write efficient, safe code.

LUA #

MoonScript #

AHK #

Tasker (Android) #

CMD.exe #

Bash, ZSH, Fish, Xonsh, wut? #

Node-Red #

n8n #

Is this even Programming anymore? #

Pure-Data #

vvvv #

tooll.io #

ORCΞ‘ #

Esolangs, the hole goes deeper #

https://en.wikipedia.org/wiki/Esoteric_programming_language

Awesome Esolangs (Github)

https://esolangs.org

Brainfuck Designer

Piet

Hello World implimented in Piet (Source)

Puddlelang

Blancmange

RETURN

Moonstroke - 3d

Nandlang

bitman

Spiral

0@v*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v
*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^
v
^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v=
***^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^
*
**********v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^##
*^v*^v*^v*^v*^v*^v*^v*^v*^v#######################
v
^*v^*v^*v^**************v^*v^*v^*v^*v^*v^**********
#########^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v*^v****
#
###############v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*v^*
                         v*^v*^v*^v**************^v
 ====               X    @
 i:vX==:====     u@vX=@v i!  ==XX  ===v^==
    X vs.vuv     @===        s=vv=X=$v=  v
                             =X     X =  #
                                    ===@v@X

ROT13 implimented in Spiral

Tree

      ^
    ^^|^^
   ^^\|/^^
   H^ |/^^^
     \| e
      |/
   ol~|
     \|
  , 32|
   \/ |
    \ |  W
 l   \| /
 \  d |/  o
  \/ !|r /  
   \/ |\/
    \ |/
     \|

Hello World implimented in Tree

Ziim

Hello World implimented in Ziim

SendStuff (unimplemented)

PowerPoint is Turing Complete

Graphics Programming #

look to chapter 26 for programming involving graphics, including node based shader editors and more

Functional Programming #

Look at Chapter 27 for Functional Programming

Lisp, Haskell, Luna,

Database (SQL) #

Look at Chapter 18 for information on Databases


If you would like to support my development of OpGuides, please consider supporting me on Patreon or dropping me some spare change on Venmo @vegadeftwing - every little bit helps ❀️