Friday, 28 August 2020

Flock, Day 1, Version 0.0.0

Ok.....
Right....
If....

Its been about 6 months since I decided to write my own programming language. Although admittedly I have been wanting to do this for at least 15 years. I really wish I had the desire 5 years prior, then I might of actually studied some compilers at university. 

No matter, everyone thinks I am mad for attempting this, I get questions like what makes your language so special? I struggle to answer this, not because I don't think it will have anything special to offer, but generally the concept is such a wide one to sum up. 

I am a software engineer, who for years specialised in Java along the way I picked up another 10 or so programming languages and all of them wound me up. The following paragraphs is intentionally meant to ensure none of them want to invite me round for dinner.

Language designers sit in several camps:

In camp one: the deeply technical mathematicians that wouldn't know an antipattern if it bit them on the behind, they provide language constructs a day to day developer would never use. Writing code in these languages requires a ridiculous amount of time in a debugger looking for memory leaks, and code that is so verbose in order to return a simple variable, that frankly I am surprised they aren't considered a health risk due to the inevitability of carpal tunnel syndrome. I include languages like any of the C variant languages. The more characters added to the name of the C variant language the worse it gets.

In camp two: the more deeply technical computer scientists, that think the tower of hanoi problem is one worth solving in the most obtuse way possible. I include any language that includes the word log in the title.

In camp three: we have the purists who believe Object Orientation or functional programming is the only way to go. Developers, with jobs generally want to fix problems and go home, not spend a lifetime trying to break your language to get it to do something practical.

In camp four: we have morons like me who want to make a practical everyday language, most are doomed to fail. However these 'morons' occasionally look at the other 3 groups with envy, and do stupid things, like introduce lifetime semantics, or decide that in getting rid of memory allocation and deallocation, expecting a developer to care about which memory model to use is solving a problem. I am looking at you Rust. I think James Gosling knows what I am talking about.

I want to be in camp 4, but my main goal is to be pragmatic wherever possible. The following is my 10'000 ft view. This view will change, I am if anything, chaotic by nature.

  • No Garbage collector, With support for object graphs (over object trees) inspired by rust
  • Flow executions, i.e. Parallelisation without explicit threading. inspired by projectreactor.io
  • A clear distinction between what I am (Structs) and what I do (Traits)
  • Object Orientated
  • Functional
  • Strongly Typed
  • Symbol minimalist (i.e. keeping down on the number of different symbols)
  • Clearly Structured, (i.e. not perl)
  • Pointer free (no &**mayvar)
  • Convention orientated, (i.e. if most programming languages have a convention, follow that convention)
  • Operator overloading, whilst retaining clarity (tough one)
  • no lifetime semantics,
  • Machine sympathetic, (Smart resource management)
  • Fully compiled
  • Support for Dependency Injection
  • Support for Aspect Orientated Programming
  • Support for Testing (including spec by example, such as cucumber)
  • Null free
  • Extensible
  • Fast
You might look at this and think 'some of this is just library stuff' yes you are right, I am not at the point of making that distinction.

So what is my USP, there are a few, I think the biggest one for most, will be my attempt to move away from the concepts of threads to the concept of flows of execution, they sound the same. We use threads on the whole for one thing, and that is to parallelize tasks, to ensure that doing one thing doesn't block another from doing its job. What if, you don't have to care, every unit of work by its very nature is paralizable, that your software will make the best use of the resources available to it. There is a lot to work out, how do we identify blocking code, how do we identify parallelizable work, how do we not freeze the machine by over-utilizing underlying system threads to so the work.

Anyway
  • Task 1: work out how you are going to compile this -> Answer lets try LLVM.
  • Task 2: install LLVM on my windows machine, (I am not kidding you, this took 3 evenings!)
  • Task 3: Shit I am going to have to remember c++, std::move... oh come on!
  • Task 4: read the API docs for LLVM IR, where the fuck are the bits about threads.
  • Task 5: read the tutorial, ok maybe we can do this, you have written parsers before.
  • Task 6: read the tutorial again. I think you are procrastinating.
  • Task 7: Write a blog....

More (Maybe) to come.

P.S.
Flock stands for Flow and Fork, the 2 things it does for you. Now I know rk and ck don't match, but maybe I had another word in mind.

No comments:

Post a Comment

Flock Day 8

 It's been a very long time since I last posted, although I have been spending on average 2-3 hours a day cutting code since the last po...