Descriptive names, and the short names that stay allowed
The complete source of quality_names_good.ek9, compiled by the EK9 compiler. Shown on quality.html.
#!ek9 defines module site.quality.names defines function fetch() <- rtn as String: "customer" defines class Handler describe() as pure <- rtn as String: "handles errors" defines program NamesInUse() stdout <- Stdout() temporaryUser <- "hello" //Clear: temporary user record isPaymentValid <- true //Clear: payment validation state customerData <- fetch() //Clear: customer data from the database stdout.println(`${temporaryUser} ${isPaymentValid} ${customerData}`) x <- 3.0 //Cartesian coordinate y <- 2.0 //Cartesian coordinate r <- sqrt (x*x + y*y) //Polar radius theta <- y.atan2(x) //Polar angle stdout.println(`${r} ${theta}`) products <- List() of Integer for i in 1 ... 3 //Standard loop counter for j in 0 ... 2 //Nested loop counter products += i * j stdout.println($products) connectionState <- "active" //'state' is suffixed - specific errorHandler <- Handler() //'handler' is suffixed - specific stdout.println(`${connectionState}`) amount <- 100.00#USD //The Money type makes 'amount' clear distance <- 42.5km //The Dimension type makes 'distance' clear stdout.println(`${amount} ${distance}`) paymentAmount <- 100.0 //Descriptive with a bare Float stdout.println($paymentAmount) stdout.println(errorHandler.describe())
Download quality_names_good.ek9
Output
hello true customer 3.605551275463989 0.5880026035475675 [0, 1, 2, 0, 2, 4, 0, 3, 6] active 100.00#USD 42.5km 100.0 handles errors