Friday, October 23, 2009

A couple of proposals

Adding "ref: REFERENCE[like Current]" in ANY
This would to allow to easily write a manifest COLLECTION[ANY] holding non-expanded objects and references to expanded like INTEGER or REAL.
The usage would to write code like
   formatter: STRING_PRINTER is once create Result.make(std_output) end
   do_stuff is
      formatter.put_message("Cluster @(1): @(2) classes, @(2)%% non-deferred",<<"a_cluster_name", 1000.ref, 0.25.ref>>)
I'm conscious this would allow for printf-like features that mimick variadic functions, a potential way toward spaghetti-code; current alternative is formatter.put_message("Cluster @(1): @(2) classes, @(2)%% non-deferred",<<"a_cluster_name", 1000.out, 0.25.out>>) that allocates two temporary strings, nullifing/thwarting one of the main reason to use a STRING_PRINTER: avoiding creation of temporary, shortly-lived strings.

Adding ROPE string and eventually a TWINE.

Sometime ago I started a little hack named LINKED_STRING, a string implemented as a linked list of strings; the idea was to make concatenation efficient, ideally an O(1) operation; then I discovered that (quite obviously) other people had the same idea. Ropes are usually not implemented using lists as in my draft. I'm still thinkering about it.