Remove multi-let statements from Husht in favor of lat on every line, per discussion with Aaron.

Glen Whitney 2024-09-19 01:56:49 +00:00
parent 223b914c24
commit b583ed1d19

@ -71,10 +71,10 @@ fn main
let logical: bool = true let logical: bool = true
let a_float: f64 = 1.0 // Regular annotation let a_float: f64 = 1.0 // Regular annotation
an_integer = 5i32 // Suffix annotation let an_integer = 5i32 // Suffix annotation
let default_float = 3.0 // `f64` let default_float = 3.0 // `f64`
default_integer = 7 // `i32` let default_integer = 7 // `i32`
// Can infer from another line; here i64: // Can infer from another line; here i64:
let mut inferred_type = 12 let mut inferred_type = 12
@ -282,13 +282,13 @@ struct Rectangle
fn main fn main
// Create struct with field init shorthand // Create struct with field init shorthand
let name = s"Peter" //! Note s-string let name = s"Peter" //! Note s-string
age = 27 let age = 27
peter = Person name, age let peter = Person name, age
println! "{:?}", peter println! "{:?}", peter
let point: Point = Point x: 10.3, y: 0.4 let point: Point = Point x: 10.3, y: 0.4
another_point: Point = Point x: 5.2, y: 0.2 let another_point: Point = Point x: 5.2, y: 0.2
println! "point coordinates: ({}, {})", point.x, point.y println! "point coordinates: ({}, {})", point.x, point.y
@ -398,10 +398,10 @@ fn inspect(event: WebEvent)
fn main fn main
let pressed = WebEvent::KeyPress 'x' let pressed = WebEvent::KeyPress 'x'
pasted = WebEvent::Paste s"my text" let pasted = WebEvent::Paste s"my text"
click = WebEvent::Click x: 20, y: 80 let click = WebEvent::Click x: 20, y: 80
load = WebEvent::PageLoad let load = WebEvent::PageLoad
unload = WebEvent::PageUnload let unload = WebEvent::PageUnload
inspect pressed inspect pressed
inspect pasted inspect pasted
@ -635,9 +635,10 @@ fn main
//! following the `let z=`, without the `scope` //! following the `let z=`, without the `scope`
//! keyword this would merely be `let z = 2 * x` //! keyword this would merely be `let z = 2 * x`
//! (2) The final semicolon is allowed and preserved //! (2) The final semicolon is allowed and preserved
//! by Husht to suppress the return value from //! by Husht to suppress the return value from the
//! the scope, but returning the last expression //! scope, but returning the last expression from a
//! from a scope is the default for Husht //! scope is the default for Husht except in the final
//! statement of a function typed to return Unit
let z = scope let z = scope
// Final semicolon discards value; `z``()` // Final semicolon discards value; `z``()`
2 * x; 2 * x;