Yes, SmartPascal does not support generics yet.
But it is tempered by several features of the language:

  • Its awesome array support, which makes TList<T> appear quite limited;
  • The classic object pascal factory pattern of "type of class" and virtual constructors;
  • Its support of variant, which maps any Javascript native object, allowing to write snippets of code which are as powerful as TDoSomeThingWith<T> ,or the powerful TDictionary<string,TValue> engine hidden within any JavaScript object.

I'm quite confident Eric Grange (the DWS/SMS compiler main maintainer) would be able to add generics support, when he would like to, and have time to refactor the compiler AST somewhat deeply.

But are generics really mandatory for a modern language?
Why is Google not willing to introduce them in their - so trendy and modern - Go language? Isn't it because of its very good list support?
Do you really think that the following code is readable, maintainable, good OOP practice:

Fn<Integer, Integer> times3plus2 = 
Currying.<Integer, Integer, Integer>compose().ap(plus2).ap(times3);

I understand  when Lars Fosdal, in a comment of the Google+ post, wrote that "Once you go Generics, there is no way back".

Personally, I used to spend a lot of time in C# generics and several awesome C# libraries - pretty close to Stephan's great library, BTW - (ab)used (of) LINQ queries, had to fight against WCF, RhinoMock, and Unity XML configuration files, and I still prefer "classic" object pascal code, without generics.
So it was not difficult for me go find my way back.

Today, if I need something involving multiple types, I try to follow SOLID principles, define several small classes, and use inheritance to share as much code as possible.
If a template system is needed for some huge part of the code, I use SynMustache, and generate code ahead of time.
If I need a factory lazy pattern for classes, I use virtual constructors, and follow the Liskov substitution principle.
If I need stubs/mocks or factories for interfaces, a TypeInfo(IAnyInterface)reference does the job, without the generics overhead.

I can see almost nothing I could do with generics, which I could not do with regular code.
Yes, I agree I can't make my code look like C#, but I can still follow SOLID principles, without being lost in some language-level "design patterns", which sounds more like Lego bricks than true computer science.

It appears that my today's mind is the following.
IMHO as programmers, we should focus on data structures, not on code.
I'm sure you know the Linus' quote, and is what I learnt by reading Knuth and others, or looking at genuine pieces of software like the SQlite3 engine itself.

Of course, this is a matter of taste.
I currently spend hours in SMS for a new project, and also on latest versions of Delphi.
From the syntax point of view, what I can do with SMS syntax is highly compatible with Delphi code (I can share 95% of my code with Delphi), and when I need it, the 5% SMS-specific part can unleash the power of SmartPascal over JavaScript.
Beyond the syntax, what is amazing with Smart is that you can unleash the "good part of JavaScript" (I'm sure you read that book), when you need it.
Thanks to Object Pascal, I can focus on data structures (like classes, arrays or records definitions), follow SOLID principles, and still have pretty good performance - even with JavaScript as intermediate language, due to the huge amount of work that today's JS engines did accumulate.
Besides the memory hungry behavior of its GarbageCollector (which may be an issue), performance is very good, as soon as you follow some patterns in your JavaScript style of coding... just like the SMS compiler does when generating its JavaScript. The first time I looked at the JavaScript code generated by SMS, I found it pretty weird and not optimized (in terms of code size), but after a deeper analysis, and some technical readings, I was amazed. It does generates code which executes pretty fast on any modern JS engine.

In short, what I like today with SMS is that:

  1. I can use modern object pascal to focus on my data structures;
  2. I can let the SMS compiler focus on the code generation.

So, with SMS, I'm an happy programmer.
Without the need of using generics.
Lucky me!

You are welcome to comment further these ideas on Google+, which are just my today's mood and suggestive reactions, not any definitive nor