[Ur] What about a new project - general purpose ur like language which collaborates with existing languages?

Marc Weber marco-oweber at gmx.de
Tue Nov 19 21:42:06 EST 2013


Excerpts from Adam Chlipala's message of Sun Nov 17 13:49:59 +0100 2013:
> I would be looking for input from others on the best ways to modify the 
> Ur/Web tools to support PhoneGap use.
urweb is nice, and it shines if you use it in its solution space.
However real world applications also need
  - migrations
  - may have to connect to multiple databases
    (Yes, I know I could reimplement mysql access using C bindings, but
    why?)
  - ..

and suddenly urweb looks like to lock you in or cause additional
work. Adam is likely to say "urweb was written for high traffic .."
I know. Still overall work could be simplified for "ordinary projects",
too.
I'd like to stop "reinventing the wheel".

The ocaml/urweb like module system is genious:
You can describe an idea, then instantiate a module and use it.

Eg the example BinarySearchTree from http://impredicative.com/ur/tutorial/intro.html
which is a module taking a paremeter of type Comparable and t.

But why stop here? Why not allow to instantiate such a BinarySearchTree
by telling the compile
- which memory management to use
- which target language
- ..

Sample use case assuming an imaginary special C preprocessor would
exist:

/*
  // preprocessed by 
  bt = core.BinaryTree (
    comparable = ...
    target-language: C
    target-memory-management: reference-counting
  )

  bt = bt.add (2, "text");

  int r = bt.lookup(2)
 */
printf("%d", r);

Continuing in my imagination I see such (for C)

  JS_PARSER_C_1 = js_parser(for-c, use_boehmgc)
  JS_PARSER_C_2 = js_parser(for-c, use_urweb_style_memory_region_allocation_free_when_done)

  JS_PARSER_C_1.parse(string)
  JS_PARSER_C_2.parse(string)

or such for js:

  JS_PARSER_JS = js_parser(for-javascript);
  JS_PARSER_JS.parse('string'0

and so on.

I'm getting tired of reimplementing basic things such as maps, parsers.

Do you know about existing work trying to achive this or getting close ?

If it does not exist, what about trying to get funded by kickstarter and
start work on such?

Would anybody join such effort?

Eg on Haskell there have been 2 job offers:

  http://www.haskell.org/pipermail/haskell-cafe/2013-November/111440.html
  In a private mail Tom replied that some of the technologies he's the
  job offer talks about might be open source.

  and this
  http://impredicative.com/ur/tutorial/intro.html
  Haskell (for server)
  objectiv-c and java (for client-side, such as smartphones)

This shows that there are many use cases for such technology.

Yes, I know about alt-js.org ..
But if there is a project which requires using a java library I'd like
to compile the server to JVM and be done.

Eg "Paul Phillips" recently has quit TypeSafe. He contributed to the
Scala compiler for multiple years. In his interview he said "there is an
order in getting things right" => http://www.youtube.com/watch?v=TS1lpKBMkgg

I cannot write a new compiler on my own, but I'd be willing to
contribute to one.

Eg haxe comes close solving the cross platform issue.
But ther are at least two issues such as
- string type is utf-8 (js backend), and byte
  string on almost all other target platforms. thus s[10] means something
  different depending on platform/encoding used. Luckily this doesn't
  matter for .split(',') or the like.
- No callback contination abstraction (other then tha macro based monax
  monad implementation) which rerquires you to rewrite much code if you
  replace 2 by db.query('select ..', call_back) ..

Marc Weber



More information about the Ur mailing list