Faster compiler, constant records, $include_once

Executive summary of recent DWS changes from the bleeding edge:

  • Compiler/parser performance improved by about 15%.
  • Added support for constant records declaration.
  • The $include_once directive is now supported, it will include a file only if it hasn’t been already included (be it by a previous $include_once or a regular $include).
  • Fixed some issues with script-side Exception.StackTrace method for wrapped Delphi-side exceptions.
  • Fixed-size arrays accesses with constant indexes are now checked at compile-time.
  • Multiple minor fixes, refactorings, minor optimizations and unit test coverage improvements.

Something “big” is also brewing in the DWScript lab, if not quite ready for prime-time just yet 😉

Delphi ChromiumEmbedded

The ChromiumEmbedded project just released r231 and DelphiChromiumEmbedded has been updated by Henri Gourvest almost immediately (!), and you can grab the code directly from the SVN.

In this post 2 days ago, I was remarking that Chrome 11 was now even faster than FireFox4, well, it appears that further progress has been made in the WebKit and V8 engine source CEF is based one, as CEF r231 runs the Mandelbrot benchmark another 20% faster than Chrome 11, meaning that JavaScript can now handle that floating point computation almost 3 times faster than vanilla Delphi XE code (not using TCanvas, which would make Delphi look horribly worse).

FWIW you can find in the DWS SVN the first very early prototype of a DWScript to JavaScript CodeGen, whose ultimate goal is to allow running Object Pascal code in a JavaScript environment. More on that sub-project in the next weeks/months as things unfold.

SynEdit DWS Highlighter, Unicode Identifiers, Type refactorings

Here is a summary of recent changes for DWScript SVN-side:

  • A syntax highlighter for SynEdit (Unicode version, available in SynEdit’s SVN) is now available, it introduces support for DWSScript specific features (keywords, string delimiters…). It is essentially a fork of the Pascal syntax highlighter.
  • Unicode identifiers are now supported, though as always with Unicode identifiers, it may not be too wise to use them too much if you want to keep the scripts maintainable. It allows to access exposed classes or libraries that use Unicode identifiers themselves.
  • The type system refactoring is in progress, most of the changes are purely internal, a handful of corner-case bugs were spotted and fixed in the process.
  • Compiler will now hint about variables that are never written to (when coSymbolDictionary option is set).
  • Inc/Dec/Succ/Pred are now magic functions, and will return the correct type when invoked on an enumeration.

Static classes, quote-delimited strings, final, hints/warnings

Here is a quick summary of recent changes SVN-side for DWScript:

  • static classes are now in DWS, like the Prism/C# variant, they are classes which cannot be instantiated and can only have class methods or properties, but as DWScript supports the concept of meta-classes, unlike in Prism/C#, they can be virtual and sub-classed (unless you mark them as “sealed” too, of course).
    type
       TStatic = class static
          class procedure Whatever;
       end;

    Note that a static class can only be subclassed to a static class, and can only inherit from a static class (or TObject).

  • quote-delimited strings can now be used as an alternative to apostrophe-delimited strings as in JavaScript and Prism, though they are still single-line strings, like in JS and unlike in Prism.
    var hello := "bonjour l'ami";
  • the final qualifier is now supported, it can be used to indicate that a method can no longer be overridden by subclasses.
  • the compiler will now warn about invoking constructors on instances (rather than classes) when outside of a constructor.
  • method override checks have been made stricter and compiler should now report all cases of incorrect overrides.
  • new directives {$HINTS ON|OFF} and {$WARNINGS ON|OFF} are now supported, and allow to turn on/off the hints and warnings respectively.

DWScript 2.2 preview 3

A source archive file for DWS 2.2 preview 3 (231 kB)  is now available. This is essentially just a zip file (7zip actually) for those not using the SVN.

Changes since the last post are rather limited:

  • built-in “QuotedStr” function now accepts a second quoteChar parameter.
  • improved compiler robustness (keeps parsing and reporting more errors in more cases), clarified some compile errors.
  • improved unit tests coverage (84.6%).

Further changes since the last archive (preview 2) are listed in the following posts:

 

Delphi 64 beta official after all

Did the attention that my little April 1st post drew help set things in motion a little earlier than planned?

It’ll be denied, it wasn’t seen, and it can’t be proven, it’s just that the slides and the video look a bit rushed, but anyway, on a just released Delphi 64 sneak preview page on the Embarcadero website, there  is a now a “join the beta” link, were you can apply for the beta. However the beta isn’t open, and Delphi XE users will apparently have priority.

As for the preview keypoints themselves, Marco Cantu has an executive summary.

It seems the beta will be under the usual NDA terms, so it may be some more time before more details filter out.

Delphi 64 open beta now available!

In a bold (or unintentional?) move, a Delphi 64 beta has been released on the Embarcadero servers, there is no official announce yet, so hit the link below while it’s still there, it may not last long!

Delphi 64 (maybe open?) beta download

..alas this was just for april’s fool… Let’s hope the next announcement about Delphi 64 availability will happen before April 2012!

edit 04/04: coincidence? They’ll deny it, no one saw them do it, and anyway no one can’t prove anything, but the following announces have just been made:
Delphi 64-bit Compiler Sneak Preview and Beta – Official Announcement
Delphi 64-bit Compiler Preview and Beta Program
And Marco Cantu has the exec summary: Delphi 64 bit Sneak Preview
With none other than David “let’s-have-a-drink” Intersimone as host for Embarcadero page for “Pulsar” beta being http://www.embarcadero.com/products/delphi/64-bit

Kudos to the Firefox 4 TraceMonkey team!

I’ve been quite impressed with the JavaScript floating point performance in FireFox 4, which puts the Delphi compiler to shame. See for yourself this fractal rendering demo:

Mandelbrot Set in HTML 5 Canvas

I’ve made a version of the same code in Delphi XE (source + pre-compiled executable, 331 kB ZIP), and on my machine here, for the 480×480 resolution, where FireFox 4 gets the default view rendered in 124 ms, where the “regular” Delphi version, which is limited to the old FPU, takes about 200 ms

(more…)