Replies: 3 comments 2 replies
-
|
Hi there! Lis draws inspiration from Rust but doesn't seek to replicate it in every way. Indentation in particular comes from Gleam and should (I hope) be easy to adjust to, even if different from Rust and Go. Converting to a GH discussion in case others would like to have a say. |
Beta Was this translation helpful? Give feedback.
-
|
Related to this: I really like formatters that avoid excessive configuration (for example, gofmt). However, one thing that makes code harder to read is enforcing a very small fixed line length. Right now this is hardcoded to 80 characters in In practice, this often causes otherwise simple code to become unnecessarily expanded vertically and harder to scan. Example with the current 80 character limit: let result = try {
let rows = pool.Query(
context.Background(),
"select foo, bar from some_database_table",
)?
let data = pgx.CollectRows<Out>(
rows,
|row| pgx.RowToStructByName<Out>(row),
)?
rows.Close()
data
}Compared to a slightly wider limit: let result = try {
let rows = pool.Query(context.Background(), "select foo, bar from some_database_table")?
let data = pgx.CollectRows<Out>(rows, |row| pgx.RowToStructByName<Out>(row))?
rows.Close()
data
}The second example is still reasonably sized (the longest line is only ~95 characters), but is much easier to read because the logical flow is preserved without excessive wrapping. I think it would make sense to either: increase the hardcoded limit to something like 120 characters, or For what it’s worth, Go’s |
Beta Was this translation helpful? Give feedback.
-
|
I am currently porting the Cappuccino Project toolchain to Golang and Lisette. Our house style is Allman - no other formatting is accepted,but this is enforced manually at the moment. With respect to line length, A new formatter will enforce Allman style but allow unrestricted line length - until such time as the typographic subtleties of semantic line breaking can be automated reliably. I have non-trivial experience with typesetting and publishing but consider this the least important concern. My own choice would be to enforce the author's house style via |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying out
lis format, and I see that it hardcodes the indent width to two spaces. It seems better to match either Rust (four spaces) or Go (one tab). Lisette programmers are likely to come from the Go and Rust communities. They will be used to one or both of those conventions and expect them in a crossover language.Beta Was this translation helpful? Give feedback.
All reactions