<br><br><div class="gmail_quote">On Wed, Sep 29, 2010 at 12:22 PM, Andreas Raab <span dir="ltr">&lt;<a href="mailto:andreas.raab@gmx.de">andreas.raab@gmx.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
On 9/29/2010 11:53 AM, Nicolas Cellier wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Another aspect of the trade-off is releasing creativity.<br>
To change the VM you need advanced skills in both:<br>
- Smalltalk VM internals<br>
- and external libraries you want to use.<br>
That resticts dramatically the list of creators.<br>
<br>
Plus, the difficulties for sharing your creation, you shall distribute:<br>
- either a binary version, but this means users cannot have a mixture<br>
of different features if those require a core modification,<br>
- or VMMaker patches but your audience will shrink again.<br>
</blockquote>
<br></div>
That&#39;s why we have plugins. Keeping the core of the VM as small as possible is most definitely a Very Good Thing and not what&#39;s being discussed here. </blockquote><div><br></div><div>I think it /is/, and you shouldn&#39;t allow your disinclination for the FFI approach blind you to the fact that one way of keeping the VM small is to produce a really strong flexible FFI that supports threading and callbacks and to implement interfaces above the line.  Do you seriously believe things like the ODBC connect should be implemented in plugins?</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">What&#39;s being discussed here is if (from that point on) one should provide layers of abstractions via plugins or if one should just expose the image directly to all of the idiosyncrasies of the platform, handing it pointers and let it make FFI calls.<br>
</blockquote><div><br></div><div>In the case of event callbacks its a different issue.  The current event queue abstraction is broken in that it prevents Smalltalk code from answering questions asked through events such as WM_QUERYENDSESSION because the VM is forced to queue events, and hence can only provide a default answer in the window proc.  So there are areas where having proper callbacks is required to be able to integrate properly with the host operating system.</div>
<div><br></div><div>I don&#39;t disagree with what you say about plugins, or about maintaining cross-platform abstractions in the VM for core functionality that is common across platforms, but I think its clear one needs true callbacks, and that at least for integrating with the GUI this is the best way to implement it.</div>
<div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">It really is a matter of where you want to deal with certain aspects of the system. I prefer to deal with that level of stuff in a plugin via C because:<br>

+ it provides a way to do ensure memory safety<br></blockquote><div><br></div><div>there&#39;s nothing in plugins per-se to maintain memory safety.  A mistake in a plugin is as destructive as a mistake in an FFI call.  In either case a wrapper around a particular call can validate and provide safety.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
+ it provides a way to provide abstractions<br></blockquote><div><br></div><div>- so does Smalltalk, and t least in SMalltalk we have inheritance to enable us to express cross-platform APIs in abstract classes and map these down onto particular platforms in concrete subclasses.  This is /far better/ than the sprawling mess that is the platforms tree in the VM.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
+ the code is faster to write and debug in C<br></blockquote><div><br></div><div>this is debatable.  In the VW FFI with the ability to catch exceptions and pass them back up (doesn&#39;t always work, a bad emory corruption may crash the entire system) makes thing easier.  But low-level debugging is painful in general.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
+ access to facilities (threads, interrupts, atomicity) not available otherwise<br></blockquote><div><br></div><div>Again, a strong FFI provides at least some of these facilities.  Not everything can be done through the FFI, but a lot can be done, and elegantly and extensibly, by Smalltalk programmers, not a few VM specialists.</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
On the downside, there is:<br>
- it&#39;s harder to modify for people who don&#39;t know C and are not set up to build a plugin<br>
- it&#39;s often aimed at the smallest common denominator (though not necessarily)<br></blockquote><div> </div><div>- it is a far more fixed interface that is far harder to evolve</div><div> </div><div>best,</div><div>Eliot</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Cheers,<br><font color="#888888">
  - Andreas</font><div><div></div><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On the other hand, a VM providing a larger de facto immutable API:<br>
- somehow is more secure (a guaranty we can run very old images in<br>
very new OSes).<br>
- can maintain the illusion that despite the efforts of OS and<br>
hardware designers to make it ever more complex, a single person can<br>
still understand (almost) the whole system.<br>
- avoid the necessity to embed knowledge of dozens of different<br>
variants of different OSes in your image.<br>
<br>
Of course, the complexity still exists under the carpet... When I<br>
contemplate all the unecessary complex knowledge from those beautiful<br>
configure/cmake scripts and macros, I&#39;m not convinced all this cruft<br>
will be easier to modify in Smalltalk than it is in C world.<br>
<br>
I perfectly understand too the desire of a VM maintainer to lighten<br>
the burden ;) though.<br>
<br>
Nicolas<br>
<br>
2010/9/29 Eliot Miranda&lt;<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>&gt;:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
On Wed, Sep 29, 2010 at 10:22 AM, Andreas Raab&lt;<a href="mailto:andreas.raab@gmx.de" target="_blank">andreas.raab@gmx.de</a>&gt;  wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
On 9/29/2010 9:36 AM, Eliot Miranda wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
    See the recordMouseEvent() and its friends (sqNextEventPut,<br>
    eventBuffer[1024] ...) in sqWin32Window, for better understanding my<br>
    point :)<br>
<br>
<br>
Which makes my point well.  These are simply maintaining a queue.  If<br>
one has callbacks then the bulk of the Windows event handling system can<br>
be lifted up into the image.  This is what Vassili Bykov did in Newspeak<br>
above my Alien callbacks.  In Newspeak the Windows MainWndProc is a<br>
callback:<br>
</blockquote>
<br>
Thus losing any level of platform abstraction. A bad trade-off, IMO.<br>
</blockquote>
<br>
The platform abstraction merely moves from the VM to classes in the image.  But it does mean that one can properly implement Windows event semantics (things like query quit events) that the queue prevents.  And it means that the VM gets simpler and complexity is handled by better facilities (in Smalltalk with its many advantages for creating and maintaining abstractions with concrete variant implementations).<br>

But you and I have had this discussion a number of times and I take your point about the VM maintaining a black-box abstraction boundary whereas the in-image implementation is in theory porous.  As I&#39;ve said before this doesn&#39;t strike me as that important when Smalltalk has had boundary violators such as instVarAt:[put:] for ever and they are rarely abused.  If one were to implement a native GUI event interface in Smalltalk using callbacks one would have to police the abstraction boundary.  But that&#39;s easily done, and there are other benefits<br>

- the VM, being simpler, gets more longevity since changing the event interface doesn&#39;t imply a VM change<br>
- the system, having native interfaces, can support each platform&#39;s facilities in full instead of providing the lowest common denominator<br>
So IMO it is a good trade-off.<br>
best<br>
Eliot<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Cheers,<br>
  - Andreas<br>
</blockquote>
<br>
<br>
<br>
</blockquote>
<br>
</blockquote>
</div></div></blockquote></div><br>