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
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.
No comments:
Post a Comment