User loginNavigation |
archivesSyntax of Literal Tables (Assocative Collections) and Auto-generated fieldsIn Heron I'm adding literal tables which like literal dictionaries/maps/hashes/tables in many languages (e.g. Python, Ruby, etc.) are intended to provide a convenient syntax for associative collection literals. The syntax looks like this:
var animals = table(animal:String, sound:String, legs:Int)
{
"Dog", "woof", 4;
"Cat", "meow", 4;
"Human", "hello", 2;
};The first column is used as a key, and the "value" is an anonymous record containing the other columns. So you you can say: Question one: what other languages that have built-in support associative collections with more than two columns? Now obviously this looks a lot like a simple array of objects: but the identity is chosen as the first field. So an interesting application is to construct an object-oriented programming system built from tables alone. It would then be helpful if the first field could be an auto-generated immutable integer id (e.g. the object address, or the database auto-generated key field). So then the question becomes what syntax should I use? I'm thinking of something like:
var animals = table(self:Id, animal:String, sound:String, legs:Int)
{
$, "Dog", "woof", 4;
$, "Cat", "meow", 4;
$, "Human", "hello", 2;
};Question two: I don't want to invent brand new syntax, what syntax do other languages use for similar features (auto-generated ids)? tools to evaporate problems(some muddling thoughts fermented with "adt vs. object" and "triz" and such.) What problems in PLT are best solved via better tools? And what are those tools? And what does it take to get there? And which ones already exist? For example:
By raould at 2010-01-20 22:21 | LtU Forum | login or register to post comments | other blogs | 1180 reads
see history of things i started (vs. commented on)?i'm looking for an old discussion but can't find it, i think i could better find it if i could restrict results by the name of the starter of the topic. but i don't see a way to do that? The Theory and Calculus of AliasingI have done some work recently on the theory of aliasing, which I believe provides the key to the frame problem and more generally to proving O-O programs (although these applications remain to be better explained and explored further). I was struck by the simplicity and generality of the laws uncovered in the process. A blog entry at bertrandmeyer.com presents the basics. It includes a link to the draft paper, and also to a downloadable version of the implementation (currently a Windows executable, the source will be released later), which makes it possible to test all the examples of the paper. -- Bertrand Meyer |
Browse archivesActive forum topics |