3 ms·
> The set of possible data type systems to choose from was very large, and to make the process more manageable I had written a program to select the competitive
by carapace 2y ago
> The set of possible data type systems to choose from was very large, and to make the process more manageable I had written a program to select the competitive (Pareto-optimal) candidate systems. Interestingly, but quite incidentally, that selection program itself was written in SETL.
Wow, now that I'd like to see.
Awesome and informative comments, cheers!
- kragen 2y agoi'm glad they were helpful!
- fuzztester 2y agoI can't even make a guess as to how such a program could be written. anyone has an idea?
- kragen 2y agoit sounds a little bogus to me, but i can outline some ways to approach it if you have a set of features, generating its powerset is fairly simple >>> powerset = lambda xs: [x0 + others for others in powerset(xs[1:]) for x0 in [[], [xs[0]]]] if xs else [[]] >>> powerset(['int', 'float', 'set', 'array']) [[], ['int'], ['float'], ['int', 'float'], ['set'], ['int', 'set'], ['float', 'set'], ['int', 'float', 'set'], ['array'], ['int', 'array'], ['float', 'array'], ['int', 'float', 'array'], ['set', 'array'], ['int', 'set', 'array'], ['float', 'set', 'array'], ['int', 'float', 'set', 'array']] then you just need some way to calculate various merits of the different designs. one merit is simplicity, which you could maybe try to operationalize as something like this: >>> [(d, {'simplicity': 10 - len(d)}) for d in powerset(['int', 'set', 'array'])] [([], {'simplicity': 10}), (['int'], {'simplicity': 9}), (['set'], {'simplicity': 9}), (['int', 'set'], {'simplicity': 8}), (['array'], {'simplicity': 9}), (['int', 'array'], {'simplicity': 8}), (['set', 'array'], {'simplicity': 8}), (['int', 'set', 'array'], {'simplicity': 7})] comparing two merit-maps such as {'simplicity': 8} and {'simplicity': 6} for pareto optimality is simple enough with some thought, especially if we assume the keys are the same: >>> some_way_better = lambda a, b: any(a[k] > b[k] for k in a) >>> defeats = lambda a, b: some_way_better(a, b) and not some_way_better(b, a) >>> defeats({'simplicity': 9}, {'simplicity': 8}) True >>> defeats({'simplicity': 8}, {'simplicity': 9}) False >>> defeats({'simplicity': 9, 'turing-complete': 0}, {'simplicity': 8, 'turing-complete': 1}) False >>> defeats({'simplicity': 9, 'turing-complete': 1}, {'simplicity': 8, 'turing-complete': 1}) True then it's easy enough to calculate which of a set of candidate designs can be eliminated because some other design defeats them the bogus part is how you automatically calculate the various merits of a hypothetical collection of language features
- carapace 2y agoYeah, what was the representation of these "data type systems" and what were the metrics I wonder.