News for hackers. Stuff that matters.
Re:Titania Programming Language by foldl2022 on Sunday September 14, 2025 @11:18PM (#45245750)
A nice side-effect of "variables at the top": you keep your functions short.
Re:Titania Programming Language by Turskarama on Monday September 15, 2025 @12:32AM (#45246138)
"Functions should always be short" is also one of those guidelines that people treat like a hard rule. There are occasions when a 100 line function is easier to read than 5 20 line functions, or god forbid 20 5 line functions.

Stop being overly dogmatic, it ALSO leads to worse code.

Re:Titania Programming Language by lenkite on Monday September 15, 2025 @07:54AM (#45248610)
There are occasions => There are only rare occasions.
Re:Titania Programming Language by mannschott on Thursday September 18, 2025 @02:15PM (#45293046)
One would assume that, but in practice, the predominant style is not one of many short procedures. Instead it feels that there's a preference to just inline the code unless the resulting procedure will have more than one caller.

For example, search for "PROCEDURE Scan" here: https://people.inf.ethz.ch/wirth/ProjectOberon/Sources/Texts...

Control structures are deeply nested and this goes on for 64 (very dense) lines. The low line count but is an artifact of how Oberon is conventionally formatted. When reformatted to mimic the conventions of languages like C, Java or Python it works out to more than 120 lines.

When I program in Oberon (recreationally) I tend to follow this style even though I would extract the same code into a separate method were I writing in Java.