In the first part I laid out my idea of dreaming about wonderful life, and not being afraid to express your dreams to others, although they might never come true. In the second part I would like to go more deeply into my dream of super-language – the one programming language to rule them all. Let the inception begin…
Summing up the idea from the first post, here are the key concepts:
- One language that can be:
- Statically typed and compiled to machine code,
- Statically or dynamically typed, compiled into bytecode and processed with virtual machine and had the option to enable or disable garbage-collection,
- Dynamically typed and processed as a script through interpreter;
- The language could mainly be object-oriented, but with procedural entry point (like main() function), which could be omitted if you are just writing some simple console script to perform administrative tasks, or just play with some code idea;
- From aspects of 1. and 2. the language would be tended to everyone:
- For operating system developers, with the features the language would offer in low levels, like asm() function allowing to write assembly code inline,
- For software developers to implement business logic and not to worry about garbage collection, like JVM or .NET Framework,
- For system administrators to script everyday tasks, like Bourne shell script,
- For web developers to script web sites and CMS, like php,
- For students to learn development step-by-step starting from non-restrictive interpreted version, moving further to byte code compiled, to machine code and CPU instruction set optimized version;
Well, does it look messy, impossible or even an utopia? Maybe.
I also touched the idea of syntax, and that it could be more or less based on Java/C# one, and I see this type of syntax really easy to read and write, but then again it is just my dream and every one of you have your own opinion on that. This is where I would like to continue my dream.
Some might suggest that the dream is not far from Google’s Go language, in which I saw really great potential, but then I found out that the garbage collector is inevitable, and the syntax somehow got messy (I say that only from my point of view, of course).
The language itself should be open-source – the compiler, the virtual machine, the interpreter as well, and it should be standardized through voting polls and every opinion we could get on the internet. I think it’s called – Democracy. But then there must be some ground rules laid out at the beginning, so that this super-language would not float away in the wrong direction.
Now I’d like to touch some aspects from the languages I like and prefer to use for different tasks.
C – the daddy of the old age, and still the most powerful language to build systems on top of any hardware. Also known as the more readable superset of assembly code.
- raw power, almost direct communication with the hardware (depends on what your operating system allows you to do with it), and if you skip the operating system, you are talking to the raw metal through interrupts;
- statically typed, strict, but still simple to understand;
- in-line assembly code – if you prefer.
- header files – a complete madness, why can’t the parser see other functions in the code without header files? I know they are good for dynamic library implementation, but that could be done with some the kind of #import pragma;
- standard type casting is somehow messy, from one side it’s good that int can be 32bit if you compile your application as 32bit one, but from other side you could always make your typedef file where you specify something like typedef MYINT int32 or typedef MYINT int64;
- NULL is just an unsigned int with value 0 (zero) – yes I know that CPU is an integer (and FPU is floating point number) processor, but that could be translated later in pre-processing to int and in the language standard the NULL could be a real type for integrities sake;
- boolean TRUE and FALSE are just unsigned int with values 1 and 0 (respectively) – same as NULL;
- no object-oriented programming support (you can add function pointers in structs, but there is no private/public controll);
- C++ – I’d like to call it just a small upgrade to C, and it’s still messy especially the OOP syntax and it’s separation from header files and source files.
C# or Java – the business partner of a developer.
- beautiful syntax;
- garbage-collector is never perfect and you still have to think about what you should clean up after you use it.
PHP – the language of web servers.
- Absolute dynamic typing;
- No strict entry point – the code begins at the 1st byte.
- Slow, really slow, compared to compiled languages, even to some non-compiled scripting languages;
- Made only for one purpose – web site development;
- On linux systems the libraries mostly have to be compiled within php, and no dynamic loading of libraries (it’s a security feature, there is a dl() function but it’s disabled by default and removed starting from version 5.3).
I might have forgotten some things here and there, but it’s the general picture of 3 powerful languages I see today. So, why can’t there be one language that overcomes all the disadvantages I wrote here, and implement all the advantages in one strong language?
Next up: the dream operating system, written in this language, using the same language for application development and shell scripting.
Nice, but language you are describing is my nightmare. Especially ‘Statically or dynamically typed’
I personally think that libraries and good IDE are more important, than way you write curly brackets.
So C++ is :
1. Statically typed and compiled to machine code,
2. machine code and VM code are the same. It’s just machine code is code for YOUR hardware, and VM is a code that is not directly usable by your computer. Use vmware and you have your VM. Basically just add a little more info so you have introspection and you are done. If you want your own VM, just make it.
3 Processed as a script interpreter ? Why not ? There is no reasons you can’t. Dynamically Typed? Well not really, but i don’t see it as a big disavantage. Statically typed languages help a lot for readability, avoid bugs and refactoring.
2. Object-oriented, has procedural entry point. Could be omitted for testing idea without not much effort.
So the real point that we could miss with C++ is a dynamically typed language.
But one must understand that if everybody where using C++ with theses addition, you’d see people trying to use a garbage collector for a small powerless embedded device, and you’ll see assembly code in IT softwares. Some applications would be blazing fast beeing compiled to machine code. Other could not use compiler because of the use of dynamic typing and would be so slow… On the opposite, some would run everywhere, other could only run on a x86 processor because the code include assembler instructions.
Half of the code would not use garbage collection and that would be the same as no garbage collection at all. (Also think what would happen if you use a library that use it if you don’t or the opposite…).
Dynamically/Satically typed if was possible would be the same. All your tooling, introspection, quality metrics would work on half of the code, and fail for the other half. Your proxiing mechanisms, you serialization mechanisms would fail for half of your code.
Languages like Java are purposely restricted. You can’t use multiple inheritance. In the begining there where no generics. All is done to ensure that your code is readable, maintenable, and that you can use tools to refactor or make proxies.
Leave a comment