Portable library
Posted: Sat May 30, 2009 11:39 pm
eric.sellon wrote:Obviously it is very important to allow access to platform-specific libraries. However, writing portable programs is important too. This portablilty is obviously achieved with having standard parts to the language (especially the standard library). Picking the contents of the standard library greatly impacts what Cobra third party libraries get written. I would suggest that part of the standard library is written in Cobra and comes with the front end and is pulled from a common directory by the back end. Other parts will be implemented in a platform-specific manner (possibly with the use of third-party libraries like CPython using tkinter) and will be provided by the back end. I'm thinking Cobra.Core for pure Cobra stuff, Cobra.Standard that will mix Cobra with native platform implementation and Cobra.StandardExtended that is most likely pure native platform implementation. Also a back end would have to provide all of Cobra.Standard to be considered a basic Cobra platform. Implementing Cobra.StandardExtended would allow it to be considered a full-featured Cobra platform. For example, sorting algorithms might be in Core or Standard while Web and GUI namespaces might be in StandardExtended. The GUI one makes a good example: it could be implemented with WinForms in .NET/Mono, with Swing on the JVM, with Cocoa for Objective-C, and with a third-party library (such as Qt or something built on top of SDL) for C++.
Yes we need a portable library so that you can write a Cobra program that runs on .NET, JVM, ObjC, etc. Of course, we won't exclude access to native libraries since they are important and since users may have legit reasons for not wanting to use the portable libraries. Such reasons could include:
-- User just wants to use Cobra to replace C#/Java/ObjC/etc. and is not looking to learn a new library.
-- User is writing UI-intensive code which is often done best with platform-specific libraries.
-- Cobra portable library will be incomplete for some time.
Regarding namespaces, it's not clear that "Cobra.Core" means pure Cobra and "Cobra.Standard" means things that must be implemented on each native platform. Nor does it seem important to me to pass that delineation on to the user. Also it seems that could change over time. Maybe a class starts out being pure Cobra but then it's determined that a custom/native implementation on each platform will greatly increase performance. Making that change would imply moving it from one namespace to another.
Regarding things like a GUI lib, a web app server, etc. I'd really like those to be separate projects so they can have their own release schedules, dev teams, etc. and so that people can download what they need. We can certainly endorse key projects on the Cobra web site if we find that users want "de facto choices" for things like "build a cross platform GUI", etc.
Now in addition to the differences in libraries, what about the language? .NET and JVM have their differences, for example. I have more thoughts on this which I will post separately at some point.