Harth is a contraction of Harvey Thompson. That way people can
be sure who the original author was.
The name also evokes the idea of a “Hearth”, a warm and cosy often
industrial sized fire-place in the home or blacksmith’s; here food is
cooked or new tools are forged.
Yet Another Programming Language?
The nice thing about standards is that there are so many of them to choose from.
Andrew S. Tanenbaum
I’ve used many programming languages in my 30 years of
programming. Each of them have some good and not-so good parts. I’ve
often wondered what would happen if you took all the reasonable bits
of each and made a programming language from that. Harth is that
Hopefully Harth will not turn into a Jack-of-all-Trades (and master
of none), nor a confusing Swiss-Army-Knife programming language (the
sort you use if you can’t find your professional toolbox).
Mine would probably be Emacs. Wait, Waaa? Emacs is actually a Lisp Programming Language runtime disguised as an extremely customizable editor.
Vi-Schmi. Visual Whatevers.
Programming Languages I Borrowed Ideas From
In building Harth I’m borrowing some of the “good” ideas from
various existing programming languages. Each of them are well worth
learning and using in their own right. I’m also very aware and am
grateful for the massive amount of work put in by all the clever
people behind each of these programming languages.
Implement these later as auto-builds from markdown docs and Doxygen code from source.
Read the [Language Reference] - uses Markdown/Hugo.
Read The [Language API] - uses Doxygen.
Project Background (September 14 2015)
The high level vision for the project is to:
Help software engineers make great tools for themselves and other software engineers.
Software Engineers (programmers) use many tools, the most important of
which is essentially a high tech type-writer; the code editor. This is
something like Word (or Notepad), and they write text (code) which is
saved in text files. There are many other tools which provide some
additional functions that help programmers. These features may already
exist in in the code editor, or may find found in a separate tool.
Other Programmer Tools
Some of the tools or features a programmer needs are;
Find Documentation - Less of the “ARGH Help How do I? Sheesh, Where is the help?”
Find Definition - The programmer can look up definitions of
particular piece of code, much like a dictionary or thesaurus.
Find References - The programmer can find all the references to a
particular piece of code, much like an index or table of contents.
Search/Replace & Refactoring - The programmer can ask the computer
to make specific global changes to the code. For example:
Changing the name of something everywhere.
Moving some code to somewhere else.
Auto Complete - The programmer can type short cuts and expand them,
like auto-complete on phones.
Error Highlighting - The programmer can see errors in their code
almost immediately, like the red squiggly lines in Word that show
Compilation - The programmer can compile the program into code, and
at this point will be told about more problems in what they have
written (like a human editor would for a book or news story).
Debugger - The programmer can run their program step by step and see
what’s going on (debugging); often this is needed because the
programmer has made a logical mistake that the computer cannot
Syntax Highlighting - The text is styled and coloured to highlight
important information: much like headings in documents.
Interactive Session - The programmer can type additional pieces of
code and perhaps modify the code while it’s running, to help correct
problems (bugs) in their code.
Unit Tests - The programmer can write extra “test” code that checks
what they have written; this can be run automatically to catch
problems which are introduced as they change their program.
Quality Tests - The programmer can use some automated code to
evaluate code quality, for example;
How much of the code has tests.
How much of the code is documented for programmers.
How complex the code is.
Issue Tracking - The programmer can create “To-Do” lists of things
they need to do later; building software is like growing a city -
you start with a one house, but very quickly there’s 1001 buildings,
each with 1001 different problems to solve.
Change Management - The programmer can save versions of code, both
locally and on the web, and use this this to collaborate with others.
Woah, Too Much!
There is an almost endless list of tools a programmer might
need. Consider Home Depot and how many hammers, drills, spanners,
screwdrivers, rulers, saws might be needed to build and maintain a
house. Likewise there are 1001 tools a programmer might need to use to
build good software. Not all the tools exist in one place, and not all
the tools are as good as they could be, or easily available, or cheap.
My aim is not to provide all 1001 tools. That task is far too big for
one person to achieve.
But we have to start somewhere.
Long Term Aims
So a more realistic aim for this project is to:
Provide a great foundation for many programmers to write and share
good tools a little easier, as and when they need them.
Currently there has been an explosion in software developers creating
new programming languages out of the desire to solve the cohesive lack
of good tools. “Yet Another Programming Language” is announced, but
most software developers groan at each solution, but can’t quite
understand why. A few have discovered that we’re often repeating the
same patterns and even mistakes. We have to try to think a little
differently, dig for the hidden gems of ideas that a few smart people
have discovered, some of these could make a big difference.
Medium Term Aims
So the more focused aim of this project is to:
Try to collect the most modern and alternative ideas in one place, to
try something a little different.
Optionally talk about types as much as possible:
Mostly static, or inferred static, with a dash of dynamic if you wants it.
Types are inferred if you assign something that’s of a known type.
Infer return type.
Infer generic types.
Closures types are inferred most of the time.
Infer argument types (that can be hard, but use generics?)
If you “do not care yet”, use dynamic which essentially says
“call method/function dynamically with cache runtime checks, your
code may crash”.
Dynamic is in C# and a few other Net based languages you know!
Non-exceptional run-time error handling - the programmer must
explicitly and consciously handle the problems user’s might face
as close to the source as possible.
Exceptions were initially thought of as a good solution, but have proven to be a “bad” idea, though many people havn’t realized or agree on this yet.
Garbage collection - the programmer is absolved from worrying about
memory management, computers are much better at doing this labor
intensive task without error. This is contentious with some
programmers; the answer to that is you shouldn’t do this for low
level programming, but we’re not dealing in this area, so it’s good
and right to do so.
Concurrency - modern computers have multiple processors, to use
these effectively the programmer needs an easy way to use the CPUs
Use task/actor systems that share only immutable data, no locking
and no mutation means the programmer can more easily understand how
to do this well and without bugs.
Self awareness - The programming language provides a library to
understand itself fully:
Convert text to an in-memory editable data structure.
Convert this in-memory structure back to text.
Analyze these data structures for full meaning, cross referencing,
and compile time (programmer) errors.
Provide layers on top for editors, scripting, compilation,
debugging and interactive features that are commonly needed.
Prototype - showing some of the basic required features listed in
Background earlier, showing how easy such tools are to build given
Prototype stretch - show some cool and mandatory but important
features to prove it really can work:
“Google Maps” Code View - this is an “exciter” in that I’ve not
seen it done in many products, only hinted at in research.
On September 14, 2015
Rough completion for this years goal (not for a full final
implementation) from the above list:
Familiar programming language - done
Static type system - done
No null pointer exceptions - done
Non-exception run-time error handling - done
Garbage collection - 80%
Concurrency - Deferred; this problem is complex to implement, not
required to progress, and has already been proven to work very well
on other projects.
Self-awareness - 50%
Prototype - 0%
Prototype stretch - 0%
Some stats, which if you’re aware of programmer productivity is very
high. However I’ve been careful to work only about 8 hours for 6 days
of the week to avoid burn out.
Lines of code written to date (from Jan 1st): 145,000
Average daily line count: 650
Number of code files: 25300
Total committed changes: 2670
On October 27, 2015
I’ve completed the Prototype goals already two months ahead of
Though not the stretch ones though, they were optional; they’ll eventually get done when it makes sense.
The plan was to finish the prototype in November and December, but
though it’s taken nine months to program the “brains” of the project,
once that was done it took only two weeks to implement the prototype
features as extensions for an existing editor (Emacs).
It will remain under my control (which means you can give me lots of
cash, I just get to keep 51%).
I reserve the right to sell it to whoever I like for one
trillion-billion whatevers. I’m not greedy however and thus:
Head towards inverse tithing (I keep 10%, give away 90% to worthy causes/endeavours).
I’d probably only buy a reasonable house and car.
Do lots of cool things for education, software and charity.
I may occasionally splash out on a nice holiday or a first class plane ticket.
I’m well aware that the likelihood of this leading to success is minimal.
Failing this, I’ll go get a normal job making software controlled widgets for space drones.
Source and Binary Products
Currently the prototype(s) are closed source, the code and built
products are internal prototypes for research and development.
The projection for first usable alpha is roughly somewhere within 2016
to 2017 (plus or minus as many years as required). Translation: I have
no idea really, other than that’s a huge undertaking.
Obviously if a few people help out (especially full time), this might
be reduced very slightly.
What Does The Prototype (V0.2) Demonstrate?
This has essentially demonstrated one of the ideas; by providing the
“brains” as components, programmers can write better tools.
I can demonstrate editing a very simple program with the following
Syntax error checking as you type;
Editor puts red squiggly lines on erroneous text, with explanations of errors on popups.
(For prototype only updates on save).
editor jumps to definition of type.
(For prototype, works only on types).
editor can cycle through all references to type.
(For prototype, works only on types).
editor either completes unique name or gives pop-up list of possible completions to select.
Note that the features adapt to changes in the program as you edit
it - the “brains” re-analyses the whole program as it’s been written.
Technical Details (V0.2)
Create a standalone “server” process which reads, parses and
analyses a whole project from disk.
By connecting over TCP and sending commands, the “server” responds
to requests for information about the project.
The “server” can update (reload at the moment, eventually
incremental updates) the analysis of the whole project files.
Extended Emacs (a standard well known programmable editor) to talk
to this server process.
Extended and adapted existing Emacs packages (flycheck, ggtags,
company) which provide the front-end/UI/Emacs for virtually “free”.
(No point reinventing the wheel here).
Not everyone uses Emacs as a program editor, but it would be fairly
easy to write plugins for other editors; most of the work is done in
the server process (for example: you can simply use telnet or netcat
to talk to the server, it’s just a TCP text service like a web
server). The “server” should really also provide information to
format/colour/indent code - and/or possibly provide standard editor