Tag Archives: overriding

Weekend with virtuals and abstracts

What is love without tenderness? No matter how interesting or frustrating the courses are out there, I cannot work too long without polishing Skila. Since it was a bit like come-back weekend I focused on rather boring issues:

  • added syntax for un-shadowing (un-hiding) the methods from the inherited class (as I announced previously),
  • the “new” modifier works the same way as in C#. However Skila raises an error, not a warning, if it is missing,
  • there is “abstract” class (cannot be instantiated) and “virtual” one (all methods become virtual).

Plus some implementation details to check whether abstract method has a body, or non-abstract does not have any body, and so on. That‘s why I wrote “boring” — nothing spectacular here, but this work had to be done.

Next weekend looks way more interesting though — spécialité du chef on the horizon! First of all I plan to introduce exposing methods from a field of the class — thanks to it writing wrappers in container class will no longer be necessary, they will be generated automatically. Even bigger feature I have in mind — pinned constructors and “SELF” which would behave like implicit generics. Read more about the latter in the previous post I wrote.

For some time now this blog is under constant spam attack advertising losing weight. I have some respect for nowadays spammers, they got clever — every time the message looks absolutely legitimately, and the only trace of the spam is the spammer signature or nickname. The ironic fact is that for several years I wasn’t able to lose weight, but this year is different — thanks to strict (but tasty) diet which I came up with by myself and added body training from “Convict Conditioning” by Paul Wade I lost unwanted kilograms in 2 months and now I am good. So thank you spammers, I’ll pass.

Tagged , , , , ,

Inheriting methods — almost there

The last two weeks were dominated by upgrading to LALR(k) parser — I did very little from Skila TODO list, but something anyway. I almost finished dealing with methods inheritance – so far Skila supports the same model as in C#. I have one bug to hunt and one optimization to make (skipping creating empty virtual table). I don’t allow multiple class inheritance, however in general I would like to add it but without much expense. So this feature is on hold.

I rewrote generating classes and methods in the backend — now classes are pure structures (fields only) and methods are functions with extra argument this passed. Of course I had to write custom dispatcher for virtual methods — it was easier than I thought, one step less for porting the backend to JS and R.

It was great opportunity to refresh my knowledge about C# — I didn’t know that interface method declaration is implemented as a method with empty body — and while doing so my patience for two C# books I have ran out. Each time I try to get definitive answer all I find is either the story from the same as me author who feels the urge to patronize me, or mumbling over 8 pages about the given concept. Polish editions of C# in Depth by Jon Skeet and Pro C# 2010 and the .NET 4 Platform by Andrew Troelsen are for sale sold.

The incoming features are standalone functions and finding new angle for handling the data — something between C++, C# and Go. I am thinking of automatic de-/referencing the objects (this would mean no overloading based on pointer depth) with struct defaulting to data and class defaulting to non-null pointer to data — each default could be explicitly overridden though. We’ll see…

Tagged , , , , , , , ,