format(1): formatting strings for ouput #43

Open
opened 2024-02-03 06:49:24 +00:00 by emma · 4 comments
Owner

On second thought, I'm fully on board with dropping printf(1p) and using format(1). I wonder if the name could be better though - I still think "format" is vague.

I don't think out(1) is necessary. Even really fresh beginners to C are taught printf(3p) and that requires the newline to be specified.

I still believe yes(1) should be a shell script, wrapping format(1).

Originally posted by @trinity in bonsai/coreutils#27 (comment)

On second thought, I'm fully on board with dropping printf(1p) and using format(1). I wonder if the name could be better though - I still think "format" is vague. I don't think out(1) is necessary. Even really fresh beginners to C are taught printf(3p) and that requires the newline to be specified. I still believe yes(1) should be a shell script, wrapping format(1). _Originally posted by @trinity in https://git.tebibyte.media/bonsai/coreutils/issues/27#issuecomment-3169_
emma added the
enhancement
question
labels 2024-02-03 20:42:17 +00:00
Author
Owner

I feel that an out(1) or equivalent is important for a couple reasons:

  • outputting unescaped format specifiers
  • outputting unformatted strings

There’s a reason C has puts().

I feel that an `out(1)` or equivalent is important for a couple reasons: - outputting unescaped format specifiers - outputting unformatted strings There’s a reason C has `puts()`.
Owner

I see your point and agree.

I see your point and agree.
emma changed title from `printf(1p)`, `echo(1p)` alternative to `format(1)`: formatting strings for ouput 2024-02-07 06:34:59 +00:00
emma added the
help wanted
label 2024-02-08 03:26:54 +00:00
Author
Owner

Trinity and I discussed earlier that format(1) should work similarly to the Rust format! macro, for example:

; let var val
; format "{}\n" var
val
; let 
Trinity and I discussed earlier that `format(1)` should work similarly to the Rust [`format!` macro](https://doc.rust-lang.org/stable/std/fmt/index.html), for example: ``` ; let var val ; format "{}\n" var val ; let ```
Author
Owner

Trinity and I discussed earlier that format(1) should work similarly to the Rust format! macro, for example:

; let var val
; format "{}\n" var
val
; let 

Just realized this will conflict with subshells in qi if they are specified with curly braces.

> Trinity and I discussed earlier that `format(1)` should work similarly to the Rust [`format!` macro](https://doc.rust-lang.org/stable/std/fmt/index.html), for example: > > ``` > ; let var val > ; format "{}\n" var > val > ; let > ``` Just realized this will conflict with subshells in qi if they are specified with curly braces.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: bonsai/harakit#43
No description provided.