Re: libseed-list GSoC 2010 Ideas



The code I posted about has evolved a little since then,

http://git.akbkhome.com/?p=app.Builder.js;a=blob;f=XObject.js;h=e808c0abef6c2d14f59ed8823280921970e5bb86;hb=HEAD

A reasonably simple example.
http://git.akbkhome.com/?p=app.Builder.js;a=blob;f=Builder/Provider/Project/Gtk.js;h=4e914ff7292c962101cf93d87508d8a0a4d34842;hb=HEAD

basically you get
XObject.define( constructor_function,  extends_object, properties/methods )

What is looking really nice is the GObject wrapping facilities of that class.. enabling you to search for object's by ID, in a similar way to getElementById in DOM.

Regards
Alan


 --- On 03/May/2010, Jonatan Liljedahl wrote: 
> Regarding classic OOP in JS, I've been quite frustrated with the way
> JS works, since it's neither a classic OO or a working prototype
> style, but a broken mixture of both..
> 
> What I've came up with is to ignore the 'new' operator and use the
> Object.create() method for inheritance, and split the functions for
> creation and initialization, here's a small example:
> 
> Base = {}; //no inheritance
> Base.make = function() {
>     var o = Object.create(this);
>     o.init();
>     return o;
> }
> Base.init = function() {
>     this.abc = 123;
> }
> Base.dump = function() {
>     print(this.abc);
> }
> 
> Subclass = Object.create(Base); //inherit from Base
> Subclass.init = function() {
>     Base.init.apply(this); //call superclass init on this object
>     this.abc *= 42;
> }
> 
> a = Base.make();
> a.dump();
> 
> b = Subclass.make();
> b.dump();
> 
> 
> On Tue, Apr 6, 2010 at 9:04 AM, Alan Knowles <alan akbkhome com> wrote:
> > Hi,
> >
> > There has been a tiny bit of offline discussion about 'standard' or 'common' libraries,
> >
> > jQuery (IMO) is not a very good starting place, for the API really, it was designed to solve problems with DOM and browser JS. (eg. getElementById() / forsaking readable code for tiny code due to low bandwidth etc.)
> >
> > That said, some of the object construction Methods in Prototype/Jquery/extjs are quite handy and very applicable to desktop applications
> >
> > The result of some of the experiments so far are in here.
> > http://git.gnome.org/browse/introspection-doc-generator/tree/
> >
> > Object.js - for prototype/jquery type class constructors.
> > xnew.js - for a very rough registry based system. - very experimental. (not really used in that project AFAIR)
> > File.js - for an example of how creating a wrapper around GLib / Gio file utilties might look.
> >
> > The CSS features from what I gather are very Clutter dependent (although i've not really looked at that).
> >
> > Attempting to try that for Gtk is probably trying to design a square peg for a round hole.
> >
> > Scoping is also a huge difference between the Web an Seed/Gjs - the imports system, means that you no longer need to kludge huge trees to solve splattering the global namespace, it works a bit closer to the python importing idea (eg. expose what you need in from a file)
> >
> > There are few key things I think a common library could solve
> > A) adding better classic OO constructors to the language, and registries.
> > B) adding features to Gtk or Core JS to make things easier to use.
> > C) providing simpler classes that use those API's (eg. like File, a xmlHttpRequest wrapper...)
> >
> > for A and C) this really just means making available code in something like gnome-common-js so it can be used.
> > for B) - it probably involves adding methods to GObjects like Gio.simple_read()
> >
> > Documentation also has to work for all this. to make sure someone can use them. I need to work out a way to integrate the 'extra wrapper code' into the documentation for the introspection API's still.
> >
> > I'm still thinking that fixing introspection so that it could wrap any library out there, rather than hand coding bindings has some serious benefits for documentation, maintenance etc. - If the API is too complex, then a 'simple' class like C should be done in JS.
> > I've done quite a few proof of concepts with introspection. It's perfectly feasible, although I need to find a really good working use-case example to demonstrate to the developers of introspection.
> >
> > Anyway I should be around #seed and #introspection on gimpnet for the rest of the week (asiapacific hours mostly), after the easter holiday ends tommorow)
> >
> > Regards
> > Alan
> >
> >
> >
> >
> >  --- On 06/Apr/2010, Tim Horton wrote:
> >> On Apr 5, 2010, at 22:27, Brian McKenna wrote:
> >>
> >> > Wow! Thanks for the fast response.
> >> >
> >> > On 6 April 2010 11:45, Tim Horton <hortont424 gmail com> wrote:
> >> >> On 2010.04.05, at 9:33 PM, Brian McKenna wrote:
> >> >>
> >> >>> Hi everyone,
> >> >>>
> >> >>> I'm just sending in a few ideas I have for Google Summer of Code. I'd
> >> >>> really appreciate any feedback!
> >> >>>
> >> >>> My first idea is a jQuery-like library. The library would provide
> >> >>> wrappers around Gnome libraries (such as GTK, GLib/Gio, Clutter) and
> >> >>> make it very simple to use CSS like selectors, make AJAX-like
> >> >>> requests, get values of GTK widgets, do simple animations (fade and
> >> >>> property tweening), etc. The purpose is to just make it extremely
> >> >>> simple for web developers to make Gnome-based applications.
> >> >>
> >> >> I'm not totally clear what this would look like, but it sounds possibly interesting.
> >> >
> >> > Possibly something like this:
> >> >
> >> >    $ = imports.dollar;
> >> >    Gtk = imports.gi.Gtk;
> >> >    Gtk.init(Seed.argv);
> >> >
> >> >    var window = new Gtk.Window({"title": "Test"});
> >> >    $(window).quit(function(event) {
> >> >        Gtk.main_quit();
> >> >    });
> >> >
> >> >    var exit_button = new Gtk.Button({"label": "Exit"});
> >> >    $(window).append(exit_button);
> >> >
> >> >    var quit_button = new Gtk.Button({"label": "Quit"});
> >> >    $(window).append(quit_button);
> >> >
> >> >    $(window).children().click(function(event) {
> >> >        print($(event.target).attr("label"));
> >> >        $(window).quit();
> >> >    });
> >> >
> >> >    Gtk.main();
> >> >
> >> > Sorry for the strange example. The $ helper might have to be changed
> >> > if it was too confusing for jQuery developers. As you can see, I'm
> >> > trying to model it very similar to using jQuery on the web.
> >> >
> >> >>> My second idea is to provide the HTML5 API in Seed. It'd be nice to be
> >> >>> able to use Canvas, WebGL, Local Storage, Web Sockets, Drag and Drop,
> >> >>> Web Workers and Web Media (the video and audio element API). The
> >> >>> purpose for this is similar to the first idea - I want to make desktop
> >> >>> development familiar to web developers.
> >> >>>
> >> >>> Johan Dahlin has done a little bit of work on this front by
> >> >>> implementing Canvas for GJS:
> >> >>>
> >> >>> http://blogs.gnome.org/johan/2010/03/30/bridging-the-development-gap-between-desktop-and-web/
> >> >>
> >> >> Seed's had canvas semi-implemented for a while:
> >> >>
> >> >> http://git.gnome.org/browse/seed/tree/modules/canvas/seed-canvas.c
> >> >>
> >> >> http://git.gnome.org/browse/seed/tree/modules/canvas/run-tests.js
> >> >
> >> > I must have missed that module. Thanks.
> >> >
> >> >> The others would be interesting, too... though I think at least *part* of the idea with Seed was to have very little platform of its own, providing a simple scripting language that *just* wraps the GNOME platform.
> >> >>
> >> >> That's not to say it's a poor idea, but it's definitely something that the various people using Seed now should discuss and try to come to a consensus on, since Robb and I don't have a particular roadmap at this point (obviously).
> >> >
> >> > An honest question (I'm not trying to make an argument). If Seed is
> >> > just a wrapper, why was the Canvas module created (which is just
> >> > another wrapper for Cairo, right)? Is it just that the Canvas module
> >> > is a proof of concept?
> >>
> >> I actually had written a part about how we had ended up trending away from that original ideal, but I deleted it before I sent the email. So that's what I have to say to that! Over time it was hard to keep that alive...
> >>
> >> > I've seen that GNOME Shell is using CSS and JavaScript (partly because
> >> > of the popularity of JavaScript web developers). Do you think these
> >> > projects are more suited to GJS, then? I have asked here because I
> >> > have a bit more experience with Seed and so far have preferred using
> >> > it.
> >>
> >> Maybe, I don't know. I know very little about GJS or their plans or the project at all.
> >>
> >> >>> What do you think? What are the chances of these projects being
> >> >>> chosen? Would this project or Summer of Code be more suited to GJS?
> >> >>>
> >> >>> Thanks for your help,
> >> >>> Brian McKenna
> >> >>> _______________________________________________
> >> >>> libseed-list mailing list
> >> >>> libseed-list gnome org
> >> >>> http://mail.gnome.org/mailman/listinfo/libseed-list
> >>
> >> _______________________________________________
> >> libseed-list mailing list
> >> libseed-list gnome org
> >> http://mail.gnome.org/mailman/listinfo/libseed-list
> >
> > _______________________________________________
> > libseed-list mailing list
> > libseed-list gnome org
> > http://mail.gnome.org/mailman/listinfo/libseed-list
> >



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]