[Vm-dev] Re: [Pharo-project] The roadmap aka fight plan to make image control host window

Igor Stasenko siguctua at gmail.com
Wed Sep 26 00:44:13 UTC 2012

On 26 September 2012 00:47, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> On Tue, Sep 25, 2012 at 3:13 PM, Igor Stasenko <siguctua at gmail.com> wrote:
>> On 25 September 2012 19:35, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>> >
>> > On Sat, Sep 22, 2012 at 11:22 AM, Igor Stasenko <siguctua at gmail.com> wrote:
>> >>
>> >> First, we need to make one thing:
>> >>
>> >> Change the VM to not call ioProcessEvents function directly, but
>> >> rather use a variable which will hold a function pointer.
>> >> Initially, when VM starts, that function pointer is NULL, and so,
>> >> "process events" is NOP.
>> >
>> >
>> > Please don't reinvent the wheel.  The Cog source has a variable inIOProcessEvents that controls this.  If negative it disables inIOProcessEvents.  If non-negative it prevents reentrancy, essential if one is receiving events from the OS.  There's a primitive, primitiveEventProcessingControl, to flip it between the enabled and disabled states.
>> >
>> Yes i seen that.
>> But apparently, i don't want to just disable it by putting NULL, but
>> also i want to replace it (or wrap it) with own io handler (see
>> NativeBoost ;). For that, i need the function pointer.
> Unlikely.  Better to call the relevant function through the FFI.  If you're implementing a native gui you don't need the VM involved in deciding when to poll for events.

The idea about function pointer was to move ioProcessEvents into
separate plugin. Like that, if you don't build VM with this plugin,
you automatically have no UI and no ioProcessEvents, because there's
nobody who registers that function.
And then platform VM code is no longer obliged to implement that function.
For me it is first logical step in decoupling GUI handling from the
core VM feature set.
While having the flag simply disabling that function from being called.

>> > This code has been used for years in the Newspeak system which has a full native GUI on Windows.
>> >
>> Does that means that implementation is completely on language side? If
>> so, then why you need the rotten window management code in VM?
> One doesn't need it.  It's there and lies unused.

So why you need to keep something which is unused?
Especially when it is flawed, limiting and plainly wrong?

>> Lately, i seen Mars running native GUI (browser window) using Cocoa on
>> macs and GTK on linux.
>> (but you still have VM window hanging around, and you cannot get rid of it).
>> > Going your own way creates an unnecessary fork.
>> >
>> I would love to not reinvent it, but the user input handling is one of
>> the weakest spots in current VM implementaion.
>> I don't like many things there:
>>  - VM is in control whether to create window or not
>>  - VM in control what attributes window has
>>  - VM in control how to translate OS (native) events to
>> "squeak-compatible" events, often losing important bits and making
>> everything crawl like hell
>>  - VM in control when to update/refresh a window
>>  - VM decides whether it run headless or not
>>  - VM decides when to handle input events
>>  list can be continued..
>> Personally, i don't like that image assuming that VM has to provide a
>> single "default" window
>> for it. It is image, which should manage that (if it wants to), but not VM.
> You don't.  But you don't need two VMs either. The existing VM windowing code can coexist with the native GUI code.  In fact one can use the old code to debug the new code, and if you're Vassili you can switch an open window from Squeak window to native window and back :)

And, what will prevent you from using new API for GUI handling,
provided by VM plugin do to the same what Vassili did?
And is there a point in future, where you can say "okay, let's throw
this out, because it rotten to death and obsolete and there's far
better alternative(s)?" Or there's no such point exists?

You must know well, that at certain point, if you need to reach higher
quality levels in doing something, you must rethink, what tools you
will be using (or create new, finer tools). One cannot do DNA
engineering using magnifying glass, one needs microscope.

Unless we want to prevent people from even considering using smalltalk
for something more serious than weekend hobby experiments.
Because keeping low-quality infrastructure will make sure it will stay
like that.

Well, maybe you right, maybe this stuff is not worth touching, but
instead it is better to think how to completely circumvent it and let
it rot there.
But personally, i won't feel happy knowing that VM contains code which
nobody uses and sits there waiting for someone who will attempt to run
20-years old images.
For me it doesn't makes sense: if you want to run 20-years old image,
use 20-years old VM.
Compatibility problem solved.

Best regards,
Igor Stasenko.

More information about the Vm-dev mailing list