pnathan: elephant bypasses fence to drink from pool (Default)

```

 CL-USER> (defun (setf bob) (object object2 object3) 
    (format t "Setting Bob ~a , ~a , ~a~&" object object2 object3))

 (SETF BOB)

 CL-USER> (setf (bob 'bob1 'bob2) 'bob3)
 Setting Bob BOB3 , BOB1 , BOB2
 NIL

```

Simple worked example I couldn't find on the general internet.

pnathan: elephant bypasses fence to drink from pool (Default)

A few years ago, I went on a "best language for home development" hunt. I sorted through pretty much all I knew and came out the other side with "Ocaml".

Some 1100 lines of Ocaml later, I terminated the project.

Couple reasons.

  • Generics without type specialization are painful. At some point, you have to concretize, and different types are, actually, different.
  • Similarly, the lack of good generics meant things like printing was painful[1].
  • The libraries for web interaction were very much inadequate, and tended to be async. I don't like or want async in my codebases, so that was aggravating.
  • Similarly, the libraries for interacting with postgres weren't great.
  • Build system initially was horrible; eventually things moved to a more stable point, but the hand was really burnt.
  • Modules fried my hair. Powerful and deeply opaque - even after reading most of the docs.
  • Docs were bad

I'd like to believe it's better now. I invested a lot of time into that code. The concision was fantastic. That said, the friction was very high.

I went and did things with Scala after that...

  1. See Go.
pnathan: elephant bypasses fence to drink from pool (Default)
Suppose one is writing Go - not the worst fate, but not exactly the best fate. One problem -

https://go.dev/play/p/po5A8KG6Zpv?v=goprev


package main

import "fmt"

func MapMerge1[K comparable, V any](a map[K]V, b map[K]V) map[K]V {
	m := map[K]V{}
	for k, v := range a {
		m[k] = v
	}
	for k, v := range b {
		m[k] = v
	}
	return m
}

func main() {
	disabledThing := map[string]interface{}{
		"enabled": false,
	}
	other := map[string]interface{}{
		"options": map[string]interface{}{
			"thungus": false,
		},
	}
	merged := MapMerge1(disabledThing, other)
	fmt.Println(merged)
}



there's no reason why a generic Merge1 and MergeRecursive function shouldn't be implemented.

Note that this essentially requires `interface{}` as the value type.

The actual V type should be the unification of both input types: if that can't be resolved intelligibly, then barf.

Part of the issue here is that the type system _should_ (but doesn't) have tagged union types. That would be a reasonably elegant solution to this.

hiatus end

Aug. 30th, 2022 10:19 pm
pnathan: elephant bypasses fence to drink from pool (Default)

Need to write more professionally. One part, relearning how to write more, one part, working out ideas.

Topically, looking to remark on distributed computing, cloud design, algorithmic shifts, Linux, programming, programming languages, techie productivity, etc.

Syndicate

RSS Atom

Most Popular Tags

Expand Cut Tags

No cut tags
Page generated Jun. 14th, 2025 11:08 pm
Powered by Dreamwidth Studios