proposal-binary-ast icon indicating copy to clipboard operation
proposal-binary-ast copied to clipboard

(Optional) type information

Open chicoxyzzy opened this issue 7 years ago • 3 comments

Binary AST could hold additional type information for variables, parameters and return types. This can help VMs do some optimizations ahead of time. Of course types should be statically validated but potentially this static analyse could be done by the same toolchain as used for binary AST creation. Was this idea considered?

chicoxyzzy avatar Sep 03 '18 14:09 chicoxyzzy

I've had this on my mind. Not in terms of some explicit support for type-annotations, but rather some generic facility for annotating the AST in-line with extension attributes.

These could be used to associate various pieces of information that could be used by tooling (stripped before release), and allow for a simple and straightforward processing of a single data structure across a variety of transformations and annotations.

You could do type annotations, in-line source-notes (for debug builds, reducing workflow complexity and number of artifacts), or any other arbitrary data.

Now, whether it's feasible in practice or not is something that requires careful consideration. I can sense some of the counter-arguments that might be made (e.g. possibility of hidden payloads in BinAST files, security issues, etc.). It's a good idea but it needs to be thought about carefully.

kannanvijayan-zz avatar Sep 04 '18 16:09 kannanvijayan-zz

Yes, we had early specs on how to store/strip such data with the previous format.

On the other hand, it's low-priority at the moment. We first want to ship something that works fast, and then we'll think of additional metadata!

Yoric avatar Sep 06 '18 09:09 Yoric