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

tracef should not emit a newline at the end #612

Open
jacereda opened this issue Feb 21, 2023 · 3 comments
Open

tracef should not emit a newline at the end #612

jacereda opened this issue Feb 21, 2023 · 3 comments

Comments

@jacereda
Copy link

There should be some way to emit a string without a newline, and looks like tracef is the answer if it didn't emit the final newline. See #611

In Forth it's idiomatic to emit lines like:

: foo ." 1+2=" 1 2 + . cr ;

With the current tracef behaviour it's inconvenient to implement that, since it would require buffering until a cr is performed.

@LunaAmora
Copy link
Contributor

LunaAmora commented Feb 22, 2023

Yeah, i would prefer to have both versions as one without a newline would facilitate printing various stuff in the same line (in my case, cause I like creating toy Langs, so i would have to implement string buffers first if i would like to print stuff that is more complex). But when i asked why it was this way, @aduros said on discord:
"Yeah, the intent was to have a drop in replacement for console.log() for debugging, and not fully expose stdout"

So i guess it is intended to not support this :/

@jacereda
Copy link
Author

Maybe a SYSTEM_FLAG to opt-in as I suggested in #611 (comment)

@Ruulul
Copy link

Ruulul commented Nov 20, 2023

it is possible tho to use ANSI control codes to print on the line above, move the cursor, clear the terminal...
https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797

came pretty handy on debugging real time information to me

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

No branches or pull requests

3 participants