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 😉

15 thoughts on “Faster compiler, constant records, $include_once

  1. A magical tool that will let us import any visual 3rd party libraries ?

  2. I think that JS CodeGen addition, or even that OP4JS project, can rock. With the post of about a month I started to think about that, specially about that potential cef integration that luckily is also in the works too! I’m sure this will be really useful, it has a big potential.

    And amongst other things I wondered about creating some sort of a simple RAD tool puting all that together (plus other things I can imagine that might be cool involving HTML5 and stuff) but unfortunately I can’t contribute an IDE for this as is my desire since I’m stuck in Turbo Delphi 2006 which can’t compile DWS (for instance, there are generics present in the DWScript code).

    But anyone interested and with a capable compiler can create his very own DWS simple and custom IDE in a matter of hours (even reusing the SynEdit highlighter already included in DWS), just take look at my Stylish IDE Toolkit project, and examples of how to use it like Tabitha (for FreePascal) or even the MIDletPascal 3 IDE (but this one is a little more complex).

  3. @Javier
    I completely agree. I’m monitoring these projects with a huge anticipation. I’ve made my own simple IDE using DWScript and I must say that I’m starting to love this scripting engine 🙂

  4. I wouldn’t mind if someone were to take responsibility for a DWScript IDE ;-), I just won’t have enough time to handle both engine & IDE in a meaningful way at the same time for the foreseeable future.
    I’ve got a DWScript IDE @work, but it’s hopelessly tied to a lot of proprietary components and libraries, and so no candidate for open-sourcing (or even selling in DCU-only form).
    Many of the IDE-support engine building blocks (debug, insight, refactor, etc.) are in the SVN though.

  5. @Eric
    For IDE it would be great that TdwsDebugger could work in the threaded mode. I managed to make it work that way but it required to change some dwScript source, so I decided to stay with the default mode. Main thread mode works as expected but it has some drawbacks, e.g. it freezes the main thread on the breakpoint.

  6. @Linas
    To avoid the freeze on breakpoint you can call ProcessApplicationMessages (in dwsXPlatformUI) in a loop, f.i. until the user resumes or aborts the script (via an action in your UI).

  7. @Eric
    It’s not very elegant solution. Application.ProcessMessages should be avoided in many cases IMO. I know about dwsXPlatformUI unit. I guess there is a small bug there in ProcessApplicationMessages procedure when using threaded mode in the debugger, because it calls this method from the background thread. Better would be to do a check before processing messages, e.g. if GetCurrentThreadId = MainThreadID then

  8. Are you adding support for a new language besides Pascal? Like say JavaScript to DWS?

    There is a dire need for a good IDE though.

Comments are closed.