Neko Specifications Prerelease

posted on 2005-04-27

I put online a pre-release of the Neko specifications here. There is still some work to do, on exceptions for example. FFI and Debugging features are not exactly part of the language but part of the runtime, so I’ll add them later.

Next step will be to modify the MotionScript virtual machine in order to be able to run Neko and write a compiler from Neko to this VM. Further work include compiler from Neko to Flash bytecode, MotionTypes and MotionScript to Neko code generators, and NekoML, a ML style language on top of Neko with boostrapping. Enough work at least until christmas I guess…

[edit : the neko website]

Neko announcement on LtU

posted on 2005-04-25

Since I’m almost done with the specs of Neko, I’ve posted a Forum Topic on LtU announcing the project in order to get some feedback and eventualy fix/add some things before proper release of the specifications.

Vector Graphics Engine Part 2

posted on 2005-04-21

I found it ! A very nice rasterizer, quick and with good quality AA. It’s named AntiGrain Geometry (AGG) and it’s performing very well. I now have a SWF player that works fine. Still have to work on linear & radial gradients and bitmaps fillstyles.

Thanks to Roberto Saccon for sending me the link !

Vector Graphics Engine

posted on 2005-04-19

Recently I’m writing a Vector Graphics Engine. Is it related to the Poll on mtasc list ? Maybe…

The major problem right now is about quality of SWF rendering. I checked a lot of opensource Flash Players, and as for AA, either they don’t do at all, or they do with poor quality. I’m using the Libart library but I am not satisfied with AA. This comes from the SWF file format : when you draw one shape in SWF, you have two fills, one on the left and one on the right. That means that shapes that share a border are not two shapes but one shape with some edges that have both left and right fills.

I managed to extract single colored shapes by duplicating the common edges but when rendering, there is an AA hole between the shapes. That’s because some pixels are covered for example at 70% by Shape A (red) and at 30% by Shape B (blue). The final color should then be :

    red * 0.7 + blue * 0.3

But since the shapes are rendered one over the other, you’re first applying a 70% alpha red on background color, and then a 30% blue :

    (bgcolor * 0.3 + red * 0.7) * 0.7 + blue * 0.3

Which is not at all what we want. I had then hack into Libart to be able to get at rasterization-time a pointer to some segment custom data that would tell me which fill color there is at the right. Then if the fill is transparent we blend with background color else will blend with adjacent fillcolor. I wrote a line-rasterizer that plugs into libart to test it : this way the quality is better but not perfect yet.

Looking at the quality at AA of Macromdia (now Adobe) Flash Player compared to the speed of the renderer, I now understand they did a great job on the vector engine. Now I have to go back to try some different AA methods than the Exact Pixel Coverage calculation Libart is using : it’s quite good but takes too much CPU (50% of Flash Player performances), maybe using fixed point calculations would speed a lot of things, and will open the way to add a 2×2 supersampling for better quality…

Links on LtU

posted on 2005-04-14

Here’s one of my post on LambdaTheUltimate, about Links initiative :

I agree there is room for a new language in the Web area.
Current solutions are :

  • PHP / Perl : dynamicly typed programming languages. It’s possible to build big applications with them but they tend to break easily. More important : they’re very slow, and cost a lot of server CPU
  • Java : using JSP or Java Server Application have some good points : you learn how to think your website in terms of application, it helps to structure your program, and give you some typing. However the Java type system an VM are far from flexible, and so you need to go through a lot of high-level wrappers generated in order to hide all the SQL/XML/… job done behind. Additional typing turns then into a pain, and all theses technologies together are too much heavyweight for small to medium websites.
  • Ruby/Rails , Python+Zope : didn’t investigate theses ones so much, they are also dynamic and not famous for performances

That’s why I end-up developing my own platform. I had already a fast and lightweight virtual machine, a compiler for a small dynamicly typed scripting language (MotionScript), and a high level functional+OO language with type inference (MotionTypes) which we use to develop Flash contents. All I had to do was to write a MotionTypes -> MotionScript code generator, to put the VirtualMachine into a “mod” for Apache and to add the binding for MySQL, some system commands, and some access to Apache API. And it’s now running very well.

I think that the following approachs will be successful :

  • focus on “website-as-application”, not as a bunch of scripts : build a single binary for deployment
  • have a two-steps compilation approach : from one high level language to a low level one, then to bytecode/JIT/native, this will ease 3rd party development for additionnal tools/DSL in your web framework
  • don’t try to solve all the problems at the same time. First focus on some specific point (for me it was typing and performances) and then add features after it has proven usable. My next target is database integration, but I should keep a low-level SQL bindings since some users might not want to do the “Big Jump” and learn all theses new technologies at one time.

I somehow agree with Xavier Leroy slides. In general, language designer are theorists and should focus on languages where the theory is important. A web programming language is more about standards, apis, and technology. It might be more successful in handled by engineer people (no offense to theorists people, they make most of the time very good engineers too).