Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow seperate Serialization of a unit's instructions and debug info #549

Merged
merged 5 commits into from
Jun 10, 2023

Conversation

therealbnut
Copy link
Contributor

Hi,

As discussed on the discord:

Hey, is it possible to round-trip serialise/deserialise a Unit as bytecode? Ideally as a tuple with debug info seperate.

This is the cleanest way I could think of to seperate them.

We could remove the Deref/DerefMut if we're happy to change self. to self.data in most uses within this file.

I believe it should be compatible with existing serialisations, so shouldn't break anything. However I haven't made any tests for that, I wasn't sure if any already existed.

@udoprog udoprog added the enhancement New feature or request label Jun 9, 2023
Copy link
Collaborator

@udoprog udoprog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me with some minor changes.

UnitData should only be called Data. We've gone down the route of naming things according to their modules before, but the style I'm trying to enforce now is to avoid it.

That being said, Data is very generic. Maybe a better name for that and fn data() could be found. But if not I wouldn't sweat it.

crates/rune/src/runtime/unit.rs Outdated Show resolved Hide resolved
crates/rune/src/runtime/unit.rs Outdated Show resolved Hide resolved
@therealbnut
Copy link
Contributor Author

That being said, Data is very generic

Yeah, I couldn't think of a better name, which is why I went with UnitData. They are inherently tied together. I think it's not so much that it belongs to the module, it's that it's an inherent part of the Unit, like saying "piano key" rather than "key".

@therealbnut therealbnut requested a review from udoprog June 10, 2023 05:15
@udoprog udoprog merged commit 926aa25 into rune-rs:main Jun 10, 2023
@udoprog
Copy link
Collaborator

udoprog commented Jun 10, 2023

Cheers!

@therealbnut
Copy link
Contributor Author

Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants