Hacker News new | ask | show | jobs
by cabalamat 1739 days ago
> Looks fine and dandy but could also be represented in JSON with not much effort

Yes it could. But writing the UI descriptions would be harder in JSON than in my bespoke language.

My goal in writing the tool was to maker UI descriptions as easy to write as possible. If I hadn't cared about that I wouldn't simply continued to hard-code them in Tkinter.

> I'm definitely biased being a web dev but JSON is just so widely used and supported

JSON didn't exist when I originally wrote this. If i was doing it today, it's entirely possible I would use JSON as a data interchange format.

1 comments

> But writing the UI descriptions would be harder in JSON than in my bespoke language.

For example, this:

    menu "File" {
        menuItem @New "New"
        menuItem @Open "Open..."
        menuItem @Save "Save"
        menuItem @SaveAs "Save as..."
        menuItem @Exit "Exit"
    }
Might become something like this:

    {'widget': 'menu', 'text': 'File', 'contents': [
            {'widget': 'menuItem', 'id': 'New', 'text': 'New'},
            {'widget': 'menuItem', 'id': 'Open', 'text': 'Open...'},
            {'widget': 'menuItem', 'id': 'Save', 'text': 'Save'},
            {'widget': 'menuItem', 'id': 'SaveAs', 'text': 'Save as...'},
            {'widget': 'menuItem', 'id': 'Exit', 'text': 'Exit'}
        ]
    }
Which would turn writing a UI from something that's a pleasure to something that's a chore. People who would deliberately write software that's a chore for others to use ought not IMO be writing software that will be used by other people.