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…)

DWScript: objects memory model

Objects memory management in Delphi Web Script is automatic, and you never have to worry about releasing objects in a script if you don’t want to. However, there are elements of manual memory management in DWS which provide greater control, and allow to enforce correctness of object-lifetime.

For instance, in DWS you can avoid the issue that is present in traditional GC-based environments, where references to long obsolete objects can still live in memory, and can still be invoked without triggering exceptions.

Automatic Memory Management

Up to and including version 2.2, the garbage collection is implemented in DWS through reference-counting (based on Delphi’s interfaces), and supplemented by a special garbage collector which is responsible for handling and cleaning up object dependency cycles.

If you have no particular memory constraints or requirements, you can thus safely create objects in DWS and not worry about their release. The special cycles GC means DWS isn’t vulnerable like Delphi’s interfaces-based reference-counting is.

Manual destruction of objects

With DWS 2.2, destructors are being brought back in a meaningful way, i.e you can manually destroy an object that is still referenced, and the object will then acquire a special “destroyed” status. Any attempt to access a destroyed object’s fields, or invoke a destroyed object’s methods will trigger an exception.

Beyond controlled release, this mechanism can be used to make sure that an object, even if incorrectly kept around, can’t be used anymore without an exception happening.

Note that unlike in Delphi, to guarantee the correctness of the “destroyed” status, a destroyed object that is still referenced will still use some memory, for as long as it is referenced. However, that object’s Delphi-side objects and memory can have been freed, as well as the object’s memory used to store the object’s fields.

When debugging, it is possible to iterate over all script objects (via the program’s execution object), including all the “destroyed” objects which are being kept because of “dangling” references.

Cleanup of “leaked” objects

Objects that have not been manually destroyed, and are still referenced by the time EndProgram is executed will be cleaned up without having their destructor invoked. This covers the cases where the script execution has been completed (end of code reached), has been aborted Delphi-side, via an execution timeout, or terminated because of an unhandled exception.

The destructors are not invoked because when EndProgram is triggered, the script is no longer supposed to be running in a any way or form: the stack has been torn-down, and cross-object references become meaningless as the clean up forcibly proceeds.

For external objects exposed through TdwsUnit, you will get an OnCleanup event, which allows you to release your Delphi-side objects, though in OnCleanup you have to be aware that the script has already been terminated, so you shouldn’t Call script functions, or rely on other script objects still existing or being valid.

DWScript: Class const, more hints, RTTI…

Recent additions to the SVN for Delphi Web Script:

  • class constants are now supported.
  • compiler will now warn about simple cases of unreachable code.
  • new hints available when coSymbolDictionary compile option is set:
    • compiler will hint about declared, but unused variables.
    • compiler will hint about unused Result pseudo-variable.
  • SymbolsLib brought over from DWSII repository and updated, it provides RTTI functionality from within the scripts.
  • various fixes and extensions to the unit tests suite

Temporary lull

Website will be in a temporary lull as I’m now involved almost full-time in a brand new offline project of the milk-drinking variety, codename “Lucie” 😉