2 ms·
The back in time ability sounds pretty cool. I've wondered whether any debuggers implement that idea. I also like the idea of an extensible grammar (and synta
by yters 19y ago
The back in time ability sounds pretty cool. I've wondered whether any debuggers implement that idea. I also like the idea of an extensible grammar (and syntax too, right?) I think pg should allow arc's syntax to be extended; which I remember him saying he'd do somewhere, but I haven't been able to find the quote since.
- mfp 19y ago" I also like the idea of an extensible grammar (and syntax too, right?)" Yes, that's what I meant (you change the grammar, resulting in new syntax). Some examples of what you can do with camlp4: http://martin.jambon.free.fr/pa_memo.ml http://martin.jambon.free.fr/pa_memo.ml allows to define memoized functions very conveniently: (* normal *) let fib = function 0 | 1 -> 1 | n -> fib (n-1) + fib (n-2) (* memoized *) let fib = memo 0 | 1 -> 1 | n -> fib (n-1) + fib (n-2) Automatic generation of * typed JSON marshallers (http://martin.jambon.free.fr/json-static.html http://martin.jambon.free.fr/json-static.html) type json mytype = Foo | Bar of int * int (* just add "json" to the type declaration to create to create the json_of_mytype and mytype_of_json functions *) * serialization with S-expressions (http://www.janestcapital.com/ocaml/ http://www.janestcapital.com/ocaml/) * pretty-printing, type-safe marshalling with structure-sharing, dynamic typing, equality... (http://code.google.com/p/deriving/ http://code.google.com/p/deriving/) * list comprehensions, heredocs, string interpolation, lazy pattern matching, "do syntax" for monads (very much like Haskell's)... Here's some OCaml code that relies on a rather large syntax extension of mine which allows you to generate (or verify) SQL schemas automatically and build composable queries using a typed relational algebra (the type system ensures that all queries are valid; if you change the schema and break some queries, the compiler will tell you what's wrong --- broken queries just don't compile): TABLE user users COLUMN id SERIAL AUTO PRIMARY KEY COLUMN name VARCHAR(64) UNIQUE COLUMN age INT NULLABLE INDEXED COLUMN password VARCHAR(64) END TABLE comment comments COLUMN id SERIAL AUTO PRIMARY KEY COLUMN title TEXT COLUMN text TEXT COLUMN created_at TIMESTAMPZ COLUMN author SERIAL FOREIGN(users, id) END let minors x = SELECT [User_age < (Some 18)] x let pauls = SELECT [User_name LIKE "%Paul%"] users let young_pauls = minors pauls You can read more about this extension at http://eigenclass.org/hiki/typed-relational-algebra-in-OCaml http://eigenclass.org/hiki/typed-relational-algebra-in-OCaml