[squeak-dev] java interpreter/compiler hosted with Spur?

Frank Shearar frank.shearar at gmail.com
Wed Jan 29 14:41:50 UTC 2014


On 29 January 2014 14:16, Robert Withers <robert.w.withers at gmail.com> wrote:
> sorry for the typos…corrected:
>
> On Jan 29, 2014, at 5:56 AM, Frank Shearar <frank.shearar at gmail.com> wrote:
>
>> On 29 January 2014 12:23, Robert Withers <robert.w.withers at gmail.com> wrote:
>>>
>>> Exactly, I am suggesting doing inferencing at runtime.  Instead of locking those types down, at compile time, be able to do the message send Smalltalk wise, then JIT it to be typed.  So dynamically switched from dynamic late-binding typing, to an early typing, with the optimizations.
>>>
>>> I figured it could useful to type at runtime, but if it is not needed...
>>
>> Oh, I see. The mention of Scala threw me off to thinking you
>> specifically meant Hindley-Milner, as opposed to, say, k-CFA.I think I
>> asked Eliot about this before: I wanted to know if the VM could expose
>> the types of a particular call site to the image, so that tools could
>> say "after the test suite ran, this method here at this call site is
>> sent to Number", or similar.
>
>
> I only know functional a little.  I still can’t think functionally; I think objects, but dynamic objects instead of those pojos, DOA.

Hindley-Milner is a particular way of enforcing static type checks
through inference. It happens to be a _very good_ way of doing this,
but I'm sure it's not the only way.

> I do think the details of the type systems is interesting.  Specifically, what I wanted to do in a typed (though inferenced) language, is to address the need for a wrapper proxy on an eventual ref.  One reason we need a wrapper is no reference mutations are allowed on the JVM.  If we build Java support in Cog, we can change the mutation policy.

> 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?

> Getting to the type info at runtime is key, I think.  Aren’t there 2 types of type systems?  Type vs class?  Do you or anyone know about that?

The study of type systems is a rather big subject!

> 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.)

frank

> - Robert


More information about the Squeak-dev mailing list