Serializing a TdwsProgram
Asked Answered
H

1

8

As I understand it, DWScript does not compile scripts into an intermediary bytecode.
However, I would like to be able to store a "compiled" script, to be able to send it through a stream or save it to a file.

I was wondering: Is there a way to serialize a TdwsProgram object?

I didn't manage to find any answer anywhere. I have looked over the code and it doesn't seem to be possible, but I thought I should ask the question anyway...

Hypochlorite answered 19/6, 2012 at 15:57 Comment(0)
G
9

As far as I remember, it is not implemented nor wanted by its actual maintainer (since the execution AST is a tree of objects).

See this reference article about Why no bytecode format.

The easiest would be to first stream the source code, then compile it again.

DWS compilation is very fast, faster than Delphi, and Eric tries to always improve it, even if new features are added.

Gorky answered 19/6, 2012 at 16:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.