On Jan 29, 2014, at 7:41 AM, Frank Shearar frank.shearar@gmail.com wrote:
On 29 January 2014 14:16, Robert Withers robert.w.withers@gmail.com wrote:
The other reason is that I wanted the returned promise to be typed as the real return and let the inferencer do its thing and rewrite send sites from dynamic lookup to direct calls. I was told that Hindley-Milner was what I wanted. *shrug*
Um, that sounds a bit weird, to be honest. A promise surely _can't_ be typed as the real return since there _is_ no real return: a promise can break! In Scala-ish terms (I've not written any Scala for about two years...), a Promise[Int] is fundamentally different to an Int because the latter is just a value whereas the former may or may not result at some point in a value. It's only once a Promise has resolved that things get interesting. And it sounds here like this is when you'd like to optimise the Promise wrapper away, right?
I was under the impression that Hindley-Milner was able to construct union types, which is why it was recommended to me.
The strategy behind my request is to see if Cog could support multiple languages and modern languages - i.e. broadly used languages. It seems a dynamic runtime is better than a static vm to support both flavors of languages, though runtime feedback type inferencing seems important, in my gut. Maybe it is just cool tech, great for ops.
Cog _does_ support multiple languages: Squeak and Newspeak. Given that Ruby can run on top of Gemstone (Maglev), there shouldn't be an issue with running other languages on top of Cog... assuming there's someone sufficiently interested/available to actually _do_ that. (Oh, and of course IBM ran Java on top of a Smalltalk VM in Visual Age for Java.)
It may be clearer for me to say that it would be awfully nice if Cog allowed for bytecode virtualization. In 64-bit values, a couple of bits for bytecode index (have a cache of 4 bytecode sets, so 4 different languages, concurrently executing). Add a bit for a capability/promise for pipelining. All at the expense of the range of the immediates, but maybe that’s ok, I do not know.
- Robert