-
-
Save seancribbs/1020fb807e65dfda8d97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ======== SETTING DATA ========= | |
-- Almost pythonic, with statement | |
WITH 'bucket' : 'key' AS MAP | |
INCREMENT gold_cnt BY 500 | |
DECREMENT wood_cnt BY 100 | |
ADD base64('SOMEBLOB') TO buildings_set; | |
-- A little more SQL-like | |
UPDATE MAP('bucket', 'key') | |
SET reg_lww TO 'Values!' | |
REMOVE 5 FROM int_set; | |
-- Modifying a bare counter | |
INCREMENT COUNTER('bucket','key') BY 10; | |
DECREMENT COUNTER('bucket','key') BY 5; | |
-- Modifying a bare set | |
ADD 'foo' TO SET('bucket', 'key'); | |
REMOVE 'bar' FROM SET('bucket', 'key'); | |
-- Modifying a register | |
SET REGISTER('bucket', 'key') TO base64('BYTES!'); | |
-- ======== GETTING DATA ========= | |
-- Get the whole map | |
VALUE OF MAP('bucket', 'key'); | |
-- Extracting fields from a map | |
EXTRACT gold_cnt, wood_cnt FROM MAP('bucket', 'key'); | |
-- Get the counter value | |
VALUE OF COUNTER('bucket', 'key'); | |
-- Check the counter value | |
IS COUNTER('bucket', 'key') < 0; | |
-- Get the entire set | |
VALUE OF SET('bucket', 'key'); | |
-- Check membership in a set | |
IS 10 MEMBER OF SET('bucket', 'key'); | |
-- ======== OPEN QUESTIONS ========= | |
-- 1) Should we require the language to specify the type as part of | |
-- the identifier (in the map) or as a "function"? | |
-- 2) Should we infer the underlying type from the operation? (e.g. | |
-- example, ADD/REMOVE for sets, INCREMENT/DECREMENT for counters) | |
-- 3) Does having query operations expose too many potential semantic | |
-- problems? (e.g. expectation of consistency and atomicity) | |
-- 4) Should we allow conditional updates? (e.g. if-then constructs) |
Notes from discussion Russell:
- Need way to fetch keys, remove keys from map
- Hungarian notation, does it matter?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notes from Ryan: