From: Pascal <pb...@oi...> - 2001-01-10 08:02:58
|
Uhm, not sure where your heading here.. but the DynAPI is an API, yes.. that has nothing to do with class or object based languages. The DynAPI is just sitting in the middle of your own code and the browsers DOM. That's all an API should do. Why (how) are we using it as a language? I don't see what you want to create with your OOJS, you'r actually creating another "layer"? So eventually we'll have something like your OOJS, interfacing to DynAPI code, which is interfacting thru Javascript with the DOM.. If you want to see how the DynAPI could be turned into more OOP like behaviour take a look at Dynacore.. that's basically the object model your referring to. With DynObject being the base (containing the add/remove/delete functionality) and DynLayer and DynDocument inheriting from that. What your describing with your TComponent (to much Delphi here :) is basically any widget we created upto now, but in the way that Javascript works: (chain)prototyping. This means we're again at the widget-model problem here (as I've also read a post about the superclass again) and I'm getting a bit tiered of having to explain everytime that prototyping is the way Javascript works, and that all the inheriting is working perfectly without adding extra code (or using more memory, because prototyping does not COPY the methods, but simply referes to them.. like a Delphi pointer/handle) How would your TComponent look.. like this: function TComponent() { this.canvas=new DynLayer this.canvas() return this } and widgets: function TButton() { this.component=new TComponent this.component() return this } Which is basically adding an extra level TComponent, which might contain some general code for all widgets, but since I can think of alot of widgets that are not using "general" GUI ideas the TComponent would add functionality that the widget wouldn't use. So please show me some of your ideas in code, and tell me what the advantages are (not the differences, but the advantages). cya (back to work :) Pascal Bestebroer (pb...@oi...) Software ontwikkelaar Oberon Informatiesystemen b.v. http://www.oibv.com > Eytan Heidingsfeld wrote: > > > Like I have mentioned many times before I don't like how > DynAPI is used. It > > is an API not a language, but I'm getting ahead of myself. > Let's start at > > the beginning. In the beginning there is JS. Problem number > one is that JS > > is class oriented and not object oriented therefore the > "weird" inheriting. > > That problem was later solved by my Inherit method. Problem > Number two is > > that although it is a program language that is class > oriented it doesn't > > give you the necesary building blocks to use it correctly. > Because of this > > reason I decided to write the OOJS (Object Oriented Java > Script). Before I > > explain my ideas for how when and where (which you are free and are > > encouraged to criticize) I will warn you that unlike JS > which is a scrambled > > mix of Java, C and some other languages this OOJS is Delphi > like in syntax. > > The reason for this is that when I started I was doing this > for a certain > > project which I would be working on with Delphi > programmers. Now for the > > OOJS. > > > > First of all you have the most base object TObject. All > objects inherit from > > it! It includes a small amount of properties and methods > including a create > > and a destroy (and there events). Then you have TComponent. > TComponent is > > the base class used for visual objects. How does it work. > It uses the DynAPI > > as I think it is supposed to be used, as an API. That means > that I have a > > DynLayer as a private variable. Then I have methods as such > DrawComponent, > > Draw and events such as onPaint or onRefresh. Then if you > want to create > > your visual component all you have to do is inherit from > TComponent and call > > the correct methods. As you may have noticed the event structure is > > different too. It is like in Delphi (big surprise) you > define a type which > > is basically a definition of a procedure then you implement > it and set a > > property of your object with this procedure and when the > object wants to > > invoke it calls its property for the event. > > > > This is just the beginning and I know it is very jumbled. > By tomorrow I will > > send out the basic code I have till now and anyone who is > interested in > > helping please email me. > > > > Work needed to be done: > > A. Finish fixing up base types > > B. Rewrite DynDocument to a new type called TApplication > (no biggie since > > DynDocument is 80 lines) > > C. Start converting objects from the library to the new > OOJS model (easy > > enough once model is done) > > > > Any Takers, > > > > Thanx, > > 8an > > > > _______________________________________________ > > Dynapi-Dev mailing list > > Dyn...@li... > > http://lists.sourceforge.net/mailman/listinfo/dynapi-dev > |