0xPolygonMiden / miden-vm

STARK-based virtual machine
MIT License
612 stars 150 forks source link

fix: support creation of raw identifiers when working with AST in memroy #1325

Closed bitwalker closed 2 months ago

bitwalker commented 2 months ago

This was overlooked when merging the assembler refactoring, but is required by the compiler, as it is working directly with the AST in memory, rather than parsing MASM text.

Callers are expected to uphold the validity requirements of bare/quoted identifiers when using these APIs, but failure to do so doesn't really matter that much, aside from breaking the ability to round-trip code containing the invalid identifier through the text format (and making it all but impossible to reference from other code). As a result, I don't really see a need to treat these as particularly dangerous functions, so I haven't marked them unsafe (not that there is any potential for them to be unsafe in Rust terms, but occasionally unsafe is useful for flagging things that you want to be really sure are done correctly for reasons other than memory safety).

Aside from that, I've added a note to their documentation to indicate that these are unstable functions that we can remove/change anytime, in case we later decide we would rather these not exist, we reserve the right to pull them without breaking any stability guarantees of the library.