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

Implement Process.pid & Process.ppid #43

Merged
merged 2 commits into from
Apr 28, 2021
Merged

Conversation

vladimyr
Copy link
Contributor

@vladimyr vladimyr commented Jun 7, 2020

Implement static methods pid & ppid for the Process class.

@ruby0x1 ruby0x1 closed this Jun 12, 2020
@ruby0x1 ruby0x1 reopened this Jun 13, 2020
@ruby0x1 ruby0x1 changed the base branch from master to main June 13, 2020 21:24
}

void processPpid(WrenVM* vm) {
wrenEnsureSlots(vm, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

@ruby0x1 Are there any default # of slots I can assume or does EnsureSlots need to ALWAYS be called? I'm pretty sure I don't see it used everywhere.

Copy link
Member

Choose a reason for hiding this comment

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

best to call it each time

Copy link
Contributor

Choose a reason for hiding this comment

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

Is that because we like the explicitness? It seems in most cases if you just said "there is always a minimum of 2" you'd remove the need for this boilerplate 99% of the time?

Choose a reason for hiding this comment

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

You can be sure this will be at least as the number of arguments slots. More than that is not guaranteed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I'm just asking why, if that is an intentional design decision vs always say having 2 slots which would cover a huge % of use cases.

Choose a reason for hiding this comment

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

To not require an unnecessary allocation. wrenEnsureSlots() is very fast if a grow is not needed.

Copy link
Contributor

@joshgoebel joshgoebel left a comment

Choose a reason for hiding this comment

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

This looks good to me.

@ruby0x1 ruby0x1 merged commit 4acf7b3 into wren-lang:main Apr 28, 2021
@vladimyr vladimyr deleted the process.pid branch April 29, 2021 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants