proj-oot-ootThoughts

it's annoying how in Python 2, 3/2 == 1 (b/c integer division is used). in Python 3 this is corrected.

--

Pyed Piper

https://code.google.com/p/pyp/

https://code.google.com/p/pyp/wiki/pyp_manual https://code.google.com/p/pyp/wiki/basic_examples https://code.google.com/p/pyp/wiki/intro pyp

in archive4

---

should we unify suspensions and references, eg instead of &x, just do {x}?

actually... maybe yes

---

some random unresolved Qs:

---

regarding logic and type systems and oot-as-notation:

i'd like Oot to be able to express 'logic' as well as a computer programming language but this is tough because there are various 'logics' and although FOL is a consensus base there are other logics that FOL cannot express even syntactically (except that i guess anything finite can be expressed with some laborious 'reification' encoding, eg simply a Godel-encoded string of the unicode codepoints representing an expression in some other logic; but when i say 'cannot syntactically express' i mean express 'actually using' FOL syntax, not as a string embedded within FOL).

so let's reduce our ambition; we would at least like Oot to provide SYNTAX for a wide variety of logics, even if i don't know what the perfect 'universal logic' is. Since i don't know which logic is best, the semantics of the logical syntax must be pluggable/metaprogrammable.

similarly with type systems, i don't know which type system is best; Haskell '98's seemed cool to me, but then ghc came out with all these extensions and they also seemed cool to me, so now i am left concluding that i dont know which type system i like best. So i want Oot to provide syntax that could be used for a wide variety of type systems, and then have the actual type system be pluggable/metaprogrammable.

perhaps we can take this idea 'up the stack' a little, too; i want to provide a 'suggested vocabulary' for 'concepts' like 'swap' and 'trade/exchange' and 'id/primary key' and 'equivalent' that can somehow be useful in higher-level programming, or at least interoperation. Furthermore i want concepts like 'equivalent' to map to syntax like '==', and i want '==' to be able to be easily used in DSLs via redefining 'equivalent', and i want the fact that 'equivalent' is in the 'suggested vocabulary' to somehow make things easier for metaprogramming.

---

we probably want this (from a blog post on stuff somewhat likes about Rust):

" Automatic resource management

One of the first blog posts I read about Rust was "Rust means never having to close a socket". Rust borrows C++'s ideas about Resource Acquisition Is Initialization (RAII), Smart Pointers, adds in the single-ownership principle for values, and gives you automatic, deterministic resource management in a very neat package.

    Automatic: you don't free() by hand. Memory gets deallocated, files get closed, mutexes get unlocked when they go out of scope. If you are wrapping an external resource, you just implement the Drop trait and that's basically it. The wrapped resource feels like part of the language since you don't have to babysit its lifetime by hand.
    Deterministic: resources get created (memory allocated, initialized, files opened, etc.), and they get destroyed when they go out of scope. There is no garbage collection: things really get terminated when you close a brace. You start to see your program's data lifetimes as a tree of function calls."

---

we want generics

eg

Vec<T>

---

we want something like Rust 'traits', which are sort of like Interfaces but with associated types too

---

we want slice functionality, including in strings

---

we want a Rust 'cargo'-like packaging system

---

testing:

here's some sample Rust code from a blog post:

"

  1. [test] fn test_that_foo_works() { assert!(foo() == expected_result); } "

" cargo test "

example doctest:

" / Multiples the specified number by two / / ``` / assert_eq!(multiply_by_two(5), 10); / ``` fn multiply_by_two(x: i32) -> i32 { x * 2 } "

---

Hygienic macros

---

No automatic coercions

---

No integer overflow

---

a blog post said that Rust has this property, we want this too:

" Generally, no undefined behavior in safe Rust

In Rust, it is considered a bug in the language if something written in "safe Rust" (what you would be allowed to write outside unsafe {} blocks) results in undefined behavior. You can shift-right a negative integer and it will do exactly what you expect. "

---

Pattern matching

warn on non-exhaustive pattern

destructuring bind

can pattern match on strings

can destructuring bind algebraic data types, eg (the syntax in this example is all wrong btw)

" data Shape = Circle Float Float Float

def f(s : Shape) if f isa Circle: a,b,c = Circle(f) else ... "
Rectangle Float Float Float Float

---

something like Python 'repr' or Rust #[derive(Debug)] to allow an automatic way to serialize data structures for debugging

---

Closures

---

https://www.python.org/dev/peps/pep-3099/ has a lot of good ideas! Both in what they accept and in what they reject

todo, read that link in its entirety

---

the effect of 'headers' should be idempotent, so that the compiler can forgo reading a header file a second time if it has already seen it once (e.g. avoid stuff like [2] section 'Include Guards')

---

https://www.reddit.com/r/haskell/comments/glz389/examples_of_incorrect_abstractions_in_other/

---

some inspirations:

constructs: hygenic macros (and Scheme) f-exprs (and Kernel)

easy to read-languages: Python

easy to learn languages: BASIC Python

popular languages: Python C any others?

simple languages: Python Zig Lisp/various Lisps Lua Self? Io? Forth/various Forths C/various C subsets various assembly languages/machine languages

simple to implement languages: Lisp/various Lisps Forth/various Forths various C subsets Lua what else?

powerful languages: Scheme Haskell what else?

loved languages: Python C Smalltalk Lua what else?

easy to reason about languages: ML what else?

notable ideas a small rust (two blog posts)