Monday, February 19, 2007

Z++

Нечаянно наткнулся на забавных техасских парней, торгующих компилятором языка Z++.

Язык этот содержит кучу надерганых отовсюду, часто просто дурацких фич, типа специального кейворда canvas для рисования GUI, не-ленивых версий && и ||, и т.п. Также авторы легким движением руки выкинули все лишнее, типа целых чисел параметров шаблонов и классов исключений (эксепшены могут быть только enum-ами), несмотря на это язык по мнению авторов является надмножеством C++.

При чтении туториала периодически вспоминалась старая первоапрельская статья Страуструпа про перегрузку operator whitespace.

В общем сравнению со всем этим D и прочее это просто детский лепет.

Авторы считают язык мега-кроссплатоформенным (версии для windows, linux и palm), обзывают трехсоткилобайтный рантайм "виртуальной машиной" и, видимо, очень не любят яву: в табличке "сравнение фич C++, java и Z++" в колонке для явы практически одни No, в количестве 22 штук (единственное "partially" в графе portable, причем у Z++ там однозначный yes).

В порыве яваненавистничества ребята даже отказывают яве в наличии динамических массивов, enum'ов и шаблонов:

Преимущества Z++ над Java и C++

В общем штука замечательная, конечно, на каждом форуме куча таких кулибиных со своими гениальными мегаязыками, но данный случай действительно запущенный: языку уже десять лет почти, авторы пишут про него туториалы и статьи, и продается он реальной компанией за настоящие деньги.

11 comments:

Not a kernel guy said...

Забавные ребята. Они еще и фигурные скобки невзлюбили, судя по всему. :-)

Vladimir Shabanov said...

По-моему это все-таки какой-то стеб. Уж очень убого сайт сделан. Да и сравнение языков в табличке показывает, что люди не знают ни java ни с++.

lrrr said...

Ну корпоративные сайты бывают и хуже :)
Вообще похоже что компания действительно существует, на gobignetwork.com даже сумма инвестиций приведена ($500K). Разве что состоит, похоже, в основном из одного чувака, если погуглить по его email (zorabi@ZHMicro.com) можно найти его блог и посты под ником Zorro в comp.lang.c++, comp.lang.java и т.п. :)

Dr.Z. said...

Although my mother was Russian, unfortunately I had to read your blogger through a translator. I cannot be sure that I have understood everything, as you meant to say it.

I will briefly address what I could guess you were saying.

1. C++ is portable. No, it is not. There are differences especially in PDA world. Even within Windows and UNIX there are differences. Even worse, you cannot write a C++ program without making system calls, thus your C++ source is not portable. On the other hand, Z++ is beyond portable because Z++ binaries are platform independent.

2. Z++ is superset of C++. Note that C++ is not superset of C. It is actually a linguistic extension. I have said in several places that Z++ is superset of C++ with "corrections". One of these corrections is in the area of exceptions. Indeed, C++ exception mechanism is a throw-in. Furthermore, keep in mind that Z++ enumerations are extensible.

3. Z++ is a set of throw-ins. No, that is true of C++, not Z++. Z++ is a coherent design of successful linguistic constructs. The GUI part is under revision and on the Great Day of May First you will see the final form of Z++ GUI. The Z++ language without GUI has been in its final form for years.

4. Best way to look at Z++ is to consider a C++ programmer trying to learn Z++. A person completely familiar with C++ is not necessarily ready to develop software on any platform. For instance, Palm, UNIX and Windows have their own system calls that the C++ programmer must be very familiar with. On the other hand, a Z++ programmer only needs to know Z++, and no more. No need for peculiar calls for mutex, threading, internet communications etc.

I hope this will encourage you to take a look at white papers, and begin a wonderful journey into the world of abstract application development with the Z++ version coming out on May First.

Regards,
Dr. Z.

lrrr said...

Online translator's version of this text is far from orignal, so I'll try to describe in english, why I think that Z++ is an example of over-engineered, over-complicated system that won't be able to find itself a niche in the market of software engineering.

First, I wondered why you so discourage java in your white papers and the comparison table on the site?
I agree, C++ is far from being a cross-platform development tool, but java is really cross-platform, it has a lot of useful modern language features. Particulary, java *DOES* support templates, enums and, of course, dynamic arrays. The absense of multiple inheritance support in java is not a disadvantage: java designers had serious reasons to exclude it.

The reason for including pointers in Z++ is also unclear for me. Pointers are unsafe construct, and pointers support can be justified only in case of low-level system programming evironments (like C/C++). But if the program runs inside virtual machine and is supposed to be cross-platform, it definitely won't need these low-level features, and pointers become useless and very dangerous feature.

Strictly speaking, C++ is not a superset of C, but to port C program to C++ you usually have to make only few minor changes; it is obviously not true for C++ to Z++ conversion: Z++ lacks a lot of fundamental C++ constructs, like non-type parameters for templates and exception classes (although I can understand the reasons for throwing them out).

I also wondering why you've made a lot of tiny ``improvements'' to C++, like non-lazy versions of logical operators and the support of the GUI at the keyword level. In my view, they're bring a lot of complexity to the language without adding much expressiveness.

Best Regards,
Oleg.

batyrmastyr said...
This comment has been removed by the author.
batyrmastyr said...

I don't agree with lrrr & dr.z in several places:
lrrr:
Particulary, java *DOES* support templates, enums and, of course, dynamic arrays

1)There is "c++ templates", there generics. 2) Java supports dynamic arrays on heap, not on stack. In C++ no dyn.arrays (through keyword). so table J-C++-Z++ in 12 incorrect.
1)В Java нет "c++ templates", там generics.2)Java допускает массивы в куче, а не на стеке. В с++ динамических массивов нет (через keyword) п12 неверен.
I agree, C++ is far from being a cross-platform development tool, but java is really cross-platform, it has a lot of useful modern language features.
Java is not fully portable when using GUI. it draws so differently that i can't use some UI elements because they can move under others.
Java не является полностью переносимой когда работаешь с GUI- в разных браузерах элементы UI могут заехать под другие, и хрен их нажмешь.
Pointers are unsafe construct, and pointers support can be justified only in case of low-level system programming evironments
You forgot that all Java objects are pointers(safe). i don't know which are in Z++.
Ты забываешь что в Java все объекты-указатели (безопасные). Какие они в Z++ я не знаю.
В общем Vladimir Shabanov прав - не знают они с++ и java.

Dr.Z. said...

First, thank you very much for catching a bad error, at column 12 of feature list. It should say, dynamic array on "Stack", not "Heap".
Z++ does support the same form of C++ dynamic array, which is on Heap (using the new operator). However, Z++ also has dynamic array similar to ADA. So, one can create arrays with sizes of dimensions being objects. In C++ the array indeces must be constants.
Thanks again.

I will go over the points and try to respond to each, to the best that I can. I appreciate your constructive comments. Please keep in mind that the Z++ GUI will be ready at commercial scale on May 1st. So, what I may say about GUI you may not see in the version publically available at this time.

On Java portability (even at source level, not binary). A language is portable when there is exactly one version of that language, not one for PDA, another for PC (Enterprise Edition), etc. For instance, what happens to a multithreaded program when you port it to a platform that does not support threads (like Palm)? The problem is that JVM makes system calls, while Z++ processor is self-contained. You will have threads even on Palm.

It is true that you cannot make a few modifications to C++ and turn it to Z++. At the very least your C++ program will contain platform-specific code (system/library calls). However, Z++ links with C++ dynamic libraries for certain purposes, such as Service-Oriented Architecture.

The notion of pointer is equivalent to the mathematical notion of variable or unknown. It is needed for expressiveness. For instance, consider the statement: let n be an integer. That means n ranges over the set of integers, and at any moment it is some integer. The use of term variable for an integer x in programming is a hibreed usage (concept is mathematical, we are using object x, mentally thinking that x is an integer over a subset of integers).

On C++ templates. C++ template implementation is C preprocessing technique of text editing. It simply replaces the paramenters with the arguments and passes that to the compiler. This could have been corrected, but it was not done. The point is that, a template is a parametrized type constructor. So, it should only accept types as arguments, not constants like 4, or even references to other objects. I am aware of abuses of these weakness. That does not make it correct. Finally, please note that Z++ allows the specification of patterns with templates. I really think C++ should do the same.

On C++ exceptions. First note that C++ does not (and probably never will) support resumption. Z++ supports two forms of resumptions. Now, C++ exception is a linguistic implementation of C exceptions which is good, and it does destroy objects in relevant scopes. However, there is an issue here. A C++ exception must be explicitly thrown. Now Z++ runs on its own self-contained operating system (the Z++ processor) and it has better control. For instance, it can throw exceptions for NULL pointer, Index out of range, etc. Finally, the object-oriented form of C++ exceptions does not add any expressiveness, and yet costs more to create exception objects, pass them arround and catch them. Few people realize that this is actually very costly.

Language complexity. Yes, Z++ is complex for the complier implementor. The tiny improments are to make things look like what we are familiar with. For instance, (1 < x < 5) is more familiar than (1 < x && x < 5). The full-circuit operators are actually quite useful (as seen from ADA experience). C++ logical operators are short-circuit only and this makes it hard to write certain combinations.

Z++ GUI entities are not keywords. They only have a meaning within the scope of a canvas (header file generated by tools). They do not appear anywhere else in a Z++ program (so they are essentially for programmer's convenience to see what entity is a button, etc).

The Z++ GUI type constructor is a frame (same as a class) which must be associated to a canvas. This makes Z++ GUI object-oriented, and indeed platform-idependent. Operations on GUI elements are done via operators (same for all platforms) instead of lengthy function names taking several arguments (in certain order). The GUI version currently posted for download was only to give a general idea of what is ahead, with proper corrections. The version coming out in May will present the final GUI-related operators, naming etc.

Regards,
Dr. Z.

lrrr said...

Dr.Z.>
Regarding problems with Java portability -- yes, there are some, but JVM runs on a much more platforms than Z++. Are you sure that you'll be able to implement Z++ VM on all these platforms without bringing there some platform-specific limitations?

I don't see a "coherent design of successful linguistic construct" in Z++, moreover, I can't imagine a truly elegant language based on C++ -- simply because C++ never was elegant and simple.

Pointers as a mathematical construct -- well, anything may be considered as mathematical construct.. Again, my point is that pointers are source of many of errors, and they're almost useless inside the VM. As for mathematical constructs, for me the most obvious improvement that can be made to C++ is to make enum types true algebraic data types, not a 'const int' synonym.

Small improvements to C++ you've made seem just misleading for people with C++ and who consider Z++ as C++ based language. If you forgotten about C++, in my opinion Z++ would be much better.

lrrr said...

batyrmastyr>
ну generics это вполне логичное воплощение идеи темплейтов для языка с виртуальной машиной и JIT.

И браузер тут ни при чем особо, речь-то о java, а не о js/ECMAscript :)

Dr.Z. said...

Thank you very much for your comments, young man. Obviously, it is not so easy to communicate via blogger comments. However, I can give a definite answer to a major concern.

The Z++ processor is a self-contained distributed operating system without GUI. It is only based on three standards : C++, SQL and TCP/IP. The Z++ processor does not use system calls, period. Thus, the Z++ processor is already available for any platform that supports those three standards, except for GUI.

I really appreciate your looking into Z++. Please note that Z++ does not compete with C++ because C++ is system programming language, and Z++ is a formalism for developing platform-free applications, such as Autonomous Agents, and distributed applications.

Take care.
Dr. Z.