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

Fix #417 #611

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Fix #417 #611

wants to merge 2 commits into from

Conversation

jacereda
Copy link

This is my attempt to fix tracef for the wasm3 runtime. Looks convoluted, and it is, but it's just that implementing this portably is a PITA.

@JerwuQu
Copy link
Contributor

JerwuQu commented Feb 21, 2023

Also see #599

@jacereda
Copy link
Author

That one is simpler, but doesn't allow formatting (%08d). Also, it seems to emit a newline at the end, that's bad. tracef should behave like printf. Otherwise there's no way to emit a partial line, and that's quite useful.

@JerwuQu
Copy link
Contributor

JerwuQu commented Feb 21, 2023

It behaves in both of those ways to be identical to the web runtime.

@jacereda
Copy link
Author

In that case, the web runtime is seriously broken. There must be some way to emit a single character to the console without a newline.

@JerwuQu
Copy link
Contributor

JerwuQu commented Feb 21, 2023

I personally don't see this is a big issue since you are quite literally able to format the string and shouldn't need multiple calls to it. What is the use-case here that you feel this strongly about?

More technically, web browsers can't print single characters to the log, so you'd have to buffer it. If doing it that way, aside from breaking all current games using tracef, it's arguably also unintuitive to new users when nothing comes out in the console at all if they forget the newline.

@LunaAmora
Copy link
Contributor

I personally don't see this is a big issue since you are quite literally able to format the string and shouldn't need multiple calls to it. What is the use-case here that you feel this strongly about?

The use case I feel strongly about this, is that when experimenting with creating toy Langs, it puts some unecessary difficulty/annoyance on debugging stuff, as you would have to implement an string buffer first to have an clearer debug experience. But this is not a common thing to need, so i know it's not that important :p

@jacereda
Copy link
Author

It's important to me because that's exactly my use case, a toy language.

How about having a SYSTEM_STANDARD_TRACING to opt-in for this behaviour in the wasm3 runtime?

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