Saturday, November 20, 2010

System programming languages are creeping

C++ compilation speed up.
One of the problem surrounding C++ is a lack of refactoring tools. The reason for this is a sophistication of the language. To tackle this Apple started CLANG project - which is a C++ compiler front end. Up to 60% of compilation time goes into preprocessing stage; remaining time is consumed by parser and semantic analysis. The prominent idea is that if compiler is used as part of IDE in compile-fix-compile mode (contrast it with usual batch compilation mode), a preprocessor's ouput can be cached thus providing 60% compilation time speed up[1].

Abstract syntax tree (AST) of C++.
The library structure of CLANG makes it easier to create code transformation tools... in theory. In practice, the dependency between components and unobvious initialization requirements make it nontrivial.

BitC programming language.
BitC has lisp-like syntax and provides low level access to system resources.  The goal is to push to the limits compile-time program verification. The author of a language, Jonathan S. Shapiro, was hired by Microsoft and then fired after not so long time. Odd stuff was going on.

D programming language.
D has pretty syntax, garbage collection, simplifies templates meta-programming. Walter Bright, the author of D language, says that game programmers love this language. Nice.

Heron programming language.
Heron is in a prototype mode and was introduced by Christopher Diggins here.

Rust programming language.
Rust is under development... by Mozilla.

Requirements to any system programming language.
Here are free-style requirements. The idea is "do not sacrifice performance".

Joe Duffy's thoughts about C# and performance:
If I could do it all over again, I would make some changes to C#. I would try to keep pointers, and merely not allow you to free them. Indirections would be explicit. The reference type versus value type distinction would not exist; whether something was a reference would work like C++, i.e. you get to decide. Things get tricky when you start allocating things on the stack, because of the lifetime issues, so we’d probably only support stack allocation for a subset of primitive types.

There is a design trend of implicit composition of components. In C++ we have templates, in Go there is an implicit interface implementation; duck typing in dynamic languages is everywhere. I am curious if C++ concepts will allow implicit realization.

[1] Presentation of LLVM 2.0 (particularly 40 min).

Sunday, October 31, 2010

CppIterator tool = C# IEnumerable for C++

If we need to find all substrings for a given string, retrieve file names from a directory or iterate list/tree structure in C++ we write iterators... State machinery with a pile of other boilerplate code behind implementation of iterators - conceals programmer's intentions. The idea to write only necessary code for iteration is implemented in C# language when programmer writes IEnumerable method with yield statements and a compiler generates underlying IEnumerator machinery and embeds it in a host assembly. Evidently, in theory, we can do the same trick in C++.

Saturday, October 30, 2010

Interop with Visual C++/CLI

C++/CLI glues managed and native worlds.
[1] Image is taken from"Особенности национальной охоты", 1995, 55 min.

Thursday, September 9, 2010

JetBrains intellisense add-in for C++

I wonder why JetBrains haven't launched productivity improvement sequel for C++. IntelliJ, ReSharper... now they are pushing Web direction - WebStorm, PHP,Ruby and something for Python.
But where is a C++ stuff?
Opportunities are tremendous. Market niche is of a size of dinosaurs valley. The only valuable competitor is Visual Assist X. But the current level of this project is in a Stone Age comparing to JetBrains leading products.
With each release of MS Visual Studio I think "where is a C++ stuff"? When VS 2010 was out I thought that I had expected more...
Tons of C/C++ code. Think of Linux OS sources :) Navigation is horrible. Many refactorings are not done because making them by hand is error prone and time consuming.
With an addition of concepts in C++0x some very fun checks can be made. Implement concept X, navigate to base class, method foo hides method in a base class. Uhh... I can get it any memory it would require, all CPUs or whatever.
No doubt developing of such product would be an enormous engineering effort but market gains would be even higher.
Where are "develop with pleasure" guys?
PS. in any way JetBrains remains my best software company

Wednesday, September 8, 2010

Warcraft3 Ranking plug-in fiasco

Today I thought about projects I did in the past and came up with an interesting one. The idea was to provide gameplay statistics for all Warcraft3 user created custom  games. But it ended up in a total collapse.

Battle.Net collects statistics for chosen ladder games. But there are a lot of popular games like DotA, TowerDefense. Also I wanted to gather statistics across various servers.

I created Warcraft3 plug-in which was installed on a client machine.
During a game plug-in collects player name, stats like gathered resources, killed heros, win team.
I created web site to collect those data.

My goal was to "imrove" (read create) Blizzard API for extending Warcraft3. But those guys hack Warcraft3 gameplay and do other nasty things.

If Blizzard created such API they would think about authentication mechanism. You can't create a system on hacked API because everyone else can do the same.

Thursday, July 8, 2010

Referencing executables

Haven't known that you can add reference to executable application such as console app.
In which framework have we got such feature?

Thursday, June 24, 2010

Fun 'anonymous' names in C#

dic = File.ReadLines(fixFile)
   .Where(_ => null != _.Value)
   .ToDictionary(_ => _.Key, _ => _.Value);
I have been thinking that "_" is a new c# language feature bundled with lambda...
but then I reminded m_fileName and _fileName naming styles. "_" is just innocent valid C# name.