News for hackers. Stuff that matters.
Re:Announcing Dart 2 Stable and the Dart Web Platform by nailer on Tuesday August 07, 2018 @05:25PM (#17710968)
I removed everything that seems redundant. Less syntax means less to break, and less for new programmers (who are 10x the volume of existing programmers) to learn:

    import 'package:hauberk/src/engine.dart'
    import 'package:hauberk/src/content.dart'

    content = createContent()
    save = content.createHero("blah")

    while (true) 
    watch = Stopwatch()
    watch.start()

    # Generate a dungeon at each level.
    count = 0
    for (i = 1; i <= Option.maxDepth; i++) 
        game = Game(content, save, 1)
        for (_ in game.generate())

            # Read some bit of game data so the JIT doesn't optimize the whole program away as dead code.
            if (game.hero.pos.x >= -1) count++      

    watch.stop()
    print("Generated $count dungeons in ${watch.elapsedMilliseconds}ms")
Re:Announcing Dart 2 Stable and the Dart Web Platform by aoeusnth1 on Tuesday August 07, 2018 @05:52PM (#17711187)
how are the semicolons in a for loop redundant? Without them it's extremely difficult to parse what's going on.
Re:Announcing Dart 2 Stable and the Dart Web Platform by nailer on Tuesday August 07, 2018 @06:23PM (#17711427)
Typo when removing the others. Thanks for the spot. Maybe a forEach or map might be more appropriate for all those future programmers anyway though.
Re:Announcing Dart 2 Stable and the Dart Web Platform by emmelaich on Tuesday August 07, 2018 @08:19PM (#17712156)
While you're there, you may as well indent everything after the "while(true)"
Re:Announcing Dart 2 Stable and the Dart Web Platform by nailer on Wednesday August 08, 2018 @07:07AM (#17714828)
Oops, I killed that during one of the edits.
Re:Announcing Dart 2 Stable and the Dart Web Platform by laxd on Tuesday August 07, 2018 @06:11PM (#17711340)
Separating variable declaration and reassignment at a glance makes code more clear. Indenting loop bodys makes code more clear, and the curly braces won't suddenly break. Keeping lines short makes it nicer to work with in various editor setups.
Re:Announcing Dart 2 Stable and the Dart Web Platform by nailer on Tuesday August 07, 2018 @06:23PM (#17711424)
> Separating variable declaration and reassignment at a glance makes code more clear.

Hrm, maybe. Python does well not using them - if you reassign something, it's being reassigned. Maybe, since declaration is more common, make declaration the default and reassignment explicit?

> Indenting loop bodys makes code more clear

Glad you agree.

> curly braces won't suddenly break

They do all the time, everytime indentation (how people read coe) gets out of sync with braces. Hence avoiding redundancy.

> Keeping lines short makes it nicer to work with in various editor setups.

Displaying code to match the screen is the editors job. Sometimes your screen is 30 characters, sometimes it's a lot more.