Skip to content

Add formatted printing directly into std.Buffer #4385

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

Conversation

justinbalexander
Copy link
Contributor

No description provided.

Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

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

We used to have this, and removed it in favor of One Way To Do Things (create a stream from the buffer).

However, upon reconsidering, I think this API shortcut is welcome here.

Just one little thing to fix and then this is merge-ready.

@daurnimator
Copy link
Contributor

We used to have this, and removed it in favor of One Way To Do Things (create a stream from the buffer).

However, upon reconsidering, I think this API shortcut is welcome here.

I disagree. std.Buffer is unfortunately used in several places that don't make sense (probably because of the name?). e.g. there is no reason for readUntilDelimiterAlloc to use a std.Buffer.
Perhaps we should rename it to ZeroTerminatedArrayList or similar to make its differentiating property more obvious?

@justinbalexander
Copy link
Contributor Author

It was totally the name that made me pick it originally. I ended up going with a different solution.

@justinbalexander
Copy link
Contributor Author

What should I do about the windows build timing out?

Also @daurnimator , the Buffer has a convenient api for string operations such as:

startsWith
endsWith
eql

For someone browsing the standard library, it seems to be the obvious choice.

Is the ArrayList preferred for holding variable length u8's?

@daurnimator
Copy link
Contributor

Also @daurnimator , the Buffer has a convenient api for string operations such as:

startsWith
endsWith
eql

For someone browsing the standard library, it seems to be the obvious choice.

Adding in #4405

Is the ArrayList preferred for holding variable length u8's?

Yes. Or LinearFifo if you ever need to delete data from the start.

@andrewrk andrewrk closed this in 26b2e5f Feb 25, 2020
@andrewrk
Copy link
Member

Thanks!

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.

3 participants