crystal-lang / crystal

The Crystal Programming Language
https://crystal-lang.org
Apache License 2.0
19.22k stars 1.61k forks source link

Rename `Crystal::System.print_error(fmt, *args, &)` to `printf` #14617

Closed ysbaddaden closed 1 month ago

ysbaddaden commented 1 month ago

The method doesn't print anything but merely formats a string using a subset of C printf, hence the renaming as printf(fmt, *args, &).

Also adds a #print_error(bytes) method to write to the standard error directly, without any formatting, that may be done separately (e.g. into a buffer) then written. Using a buffer is useful to avoid interleaved error messages with MT for example.

Keeps #print_error(fmt, *args) that now merely uses the other two methods.

This has been extracted from #14599.