Monday, May 1, 2023

 

Of Algol68's Aims and principles of design.

Listen up y'all, let me tell you 'bout a language,
ALGOL 68, with deep insights and sage.
Aad van Wijngaarden was the man with the plan,
To make a language that's complete and clear, understand?

Chorus:
Completeness and clarity, that was their goal,
But it may be hard for the uninitiated to behold.
ALGOL 68, a language designed with care,
With features that make it efficient and rare.

Orthogonal design, they kept it simple and neat,
To make the language easy to learn and not a feat.
Primitive concepts, they minimized the amount,
But applied them orthogonally, for maximum amount.

Security was key, for errors could lead to a mess,
But with ALGOL 68, errors were easy to address.
The syntax was designed with mode checking in mind,
To catch errors before they left any programmer blind.

Efficiency was important, for speed is a must,
But ALGOL 68 didn't require any fuss.
Static mode checking was the way to go,
No need for runtime mode checking, to keep the language flow.

Mode-independent parsing, another feature in store,
Parsing a program is easy, no need to implore.
Independent compilation, no loss of efficiency,
As long as mode specifications are provided with proficiency.

Loop optimization, a technique that's well-known,
But in ALGOL 68, it was a technique that shone.
Iterative processes, they were straightforward and true,
Optimization was easy, to make the program run through.

Representations, they were chosen with care,
So the language could be implemented anywhere.
Minimal character sets, they were a must,
But implementers could use a larger set, if they trust.

Outro:
So that's the story of ALGOL 68,
A language that's efficient, and hard to hate.
Aad van Wijngaarden and his team had it right,
ALGOL 68, a language that's a delight.
- Nova

ALGOL 68 - 0.1.3 Security
  • In language design, there's a quest 
  • To make sure errors don't infest 
  • ALGOL 68, a language fine 
  • Is one that's been designed to shine
 
  • Its syntax and errors are controlled 
  • So bugs don't lead to chaos bold 
  • Calamitous results are kept at bay 
  • With ALGOL 68, errors don't hold sway
 
  • Opportunities for mistakes are few 
  • ALGOL 68 keeps them in view 
  • Its design ensures that errors are caught 
  • Before they cause chaos, as they ought not

  • Security is its top priority 
  • ALGOL 68 is a language of quality 
  • For syntax and errors, it's well-equipped 
  • A language to use without fear of slip.
 - Nova

Friday, April 21, 2023

ZFS Build and Install on a Pi.

cf. https://github.com/NevilleDNZ/zfs_build_dkms_hints

 e.g.

#!/bin/bash
uname_m=`uname -m` # "aarch64"
uname_r=`uname -r` # "6.1.21-v8+"
zfs_r="2.1.9"
sudo apt update -y
sudo apt upgrade -y
mkdir -p $HOME/zfs_build/zfs-k"$uname_r"
cd $HOME/zfs_build/zfs-k"$uname_r"
wget https://github.com/openzfs/zfs/releases/download/zfs-"$zfs_r"/zfs-"$zfs_r".tar.gz -O zfs-"$zfs_r".tar.gz
tar -xzf zfs-"$zfs_r".tar.gz
cd zfs-"$zfs_r"
sudo apt install -y alien build-essential fakeroot gawk
sudo apt install -y raspberrypi-kernel-headers
sudo apt install -y gcc make autoconf automake libtool dkms python3 python3-cffi python3-packaging python3-setuptools python3-dev uuid-dev zlib1g-dev libaio-dev libattr1-dev libblkid-dev libcurl4-openssl-dev libelf-dev libffi-dev libssl-dev libudev-dev
sh autogen.sh
./configure
make -s -j4 deb
sudo apt install -y ./libnvpair3_"$zfs_r"-1_arm64.deb ./libuutil3_"$zfs_r"-1_arm64.deb ./libzfs5_"$zfs_r"-1_arm64.deb ./libzpool5_"$zfs_r"-1_arm64.deb ./zfs_"$zfs_r"-1_arm64.deb ./zfs-dkms_"$zfs_r"-1_arm64.deb


 

A bit of fun with Jabberwocky, classes, mixins, python3's super() and method resolution order (MRO)

I was trying to figure out and demonstrate python's Member Resolution Order... In particular, pay attention to the output from __str__...

 ¢ in a previous post I'd done the same, but in py2. ¢

#!/usr/bin/env python
# -*- coding: utf-8 -*-

class BeastBase(dict):
def __init__(self, **characteristics):
super().__init__(**characteristics)

def __str__(self):
return "; ".join(["%s=%r"%item for item in super().items()])

class Mixin(object): pass

class BitingMixin(Mixin):
def __init__(self, jaws=2, teeth_per_mouth=32, **characteristics):
self.jaws=jaws
self.teeth_per_mouth=teeth_per_mouth
super().__init__(**characteristics)

def bite(self):
print("Bite: jaws=%s, teeth=%s"%(self.jaws, self.teeth_per_mouth*self.jaws/2))

def __str__(self):
return "Jawed: %s; %s"%(self.jaws, super().__str__())

class JawedBeast(BeastBase, BitingMixin): pass

class ClawingMixin(Mixin):
def __init__(self, feet=4, toes_per_foot=3, **characteristics):
self.feet=feet
self.toes_per_foot=toes_per_foot
super().__init__(**characteristics)

def catch(self):
print("Catch: feet=%s, toes=%s"%(self.feet, self.toes_per_foot*self.feet))

def __str__(self):
return("Claws: %s; %s"%(self.toes_per_foot*self.feet, super().__str__()))

class ClawedBeast(BeastBase, ClawingMixin): pass

class FlamingMixin(Mixin):
def __init__(self, eyes=6, flames_per_eye=1, **characteristics):
self.eyes=eyes
self.flames_per_eye=flames_per_eye
super().__init__(**characteristics)

def flame(self):
print("Flames:", self.eyes*self.flames_per_eye)

def __str__(self):
return("Eyes: %s, Flames: %s; %s"%(self.eyes, self.eyes*self.flames_per_eye, super().__str__()))

class FlamedBeast(FlamingMixin, BeastBase): pass

class WhifflingMixin(Mixin):
def whiffle(self):print ("Whiffle....")
def __str__(self): return "Whiffling... "+super().__str__()

class WhifflingBeast(WhifflingMixin, BeastBase): pass

class BurblingMixin(Mixin):
def burble(self): print("Burble....")
def __str__(self): return "Burbling... "+super().__str__()

class BurblingBeast(BurblingMixin, BeastBase): pass

class Jabberwocky(BitingMixin, ClawingMixin, FlamingMixin, WhifflingMixin, BurblingMixin, BeastBase):
def __init__(self, **characteristics):
super().__init__(**characteristics)

def __str__(self):
return "JabberWocky: "+super().__str__()+" ... Beware! "

if __name__ == "__main__":

# Beware the Jabberwock, my son!
jabberwocky1=Jabberwocky(personality="Friendly", consideration="Temperamental", eyes=5, flames_per_eye=3)
print(jabberwocky1)

# Beware the Jubjub bird, and shun
# The frumious Bandersnatch!

# The jaws that bite, the claws that catch!
jabberwocky1.bite()
jabberwocky1.catch()

# And as in uffish thought he stood,
# The Jabberwock, with eyes of flame,
jabberwocky1.flame()

# Came whiffling through the tulgey wood,
jabberwocky1.whiffle()
# And burbled as it came!
jabberwocky1.burble()

Output: ¢ In particular, pay attention to the output from __str__... ¢

JabberWocky: Jawed: 2; Claws: 12; Eyes: 5, Flames: 15; Whiffling... Burbling... personality='Friendly'; consideration='Temperamental' ... Beware!
Bite: jaws=2, teeth=32.0
Catch: feet=4, toes=12
Flames: 15
Whiffle....
Burble....