Search the web
Sign In
New User? Sign Up
openLingo · openLingo Code Library
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
javascript in MX 2004   Message List  
Reply | Forward Message #621 of 643 |
Re: [openLingo] javascript in MX 2004

----- Original Message -----
From: "Ben St Johnston" <ben@...>
>
> That might not always work. If you are providing a library of "classes"
> which people can extend,

But that's not what we are doing. We are providing an object-oriented
toolset, which people can incorporate into higher-level scripts. There will
be a collection of high-level scripts and behaviours that use the main
library as well, so perhaps such classes would fall into that category, but
that is not part of the main project.

> It is also the case that lingo cannot contruct javascript objects and vice
> versa, although given a reference either language can use objects written
> in the other language. Therefore, you should provide factory methods (e.g.
> createMyObject()) rather than expecting people to call new MyObject or
> script("MyObject").new().

This is true, at some point we need to have a generic factory object as part
of the library anyway, in fact it's one of the things we should have already
addressed.

If you want to instantiate ECMAScript objects in Lingo then you can simply
write your scripts slightly differently - in fact, this method is
preferrable in ECMAScript because of the way inheritance works (I won't get
too into that just now). What you do is this:

function someobject_memberFunction()
{
return this.someProperty;
}

function someobject()
{
var temp = new Object();
temp.someProperty = "a property";
temp.memberFunction = someobject_memberFunction;
return temp;
}

As opposed to:

function someobject()
{
this.someProperty = "a property";
this.memberFunction = someobject_memberFunction;
}

(the latter requires the new operator, whereas the former is simply a
self-contained factory for the object)

BTW, I always declare member functions outside of the class definition and
use that convention, i.e.: classname_functionname. I haven't been doing much
JavaScript programming lately, but if I were, I would start using this
instantiation method more because JavaScript does not have any inheritance
in the C++ sense, but by using these self-contained factory functions
instead of a class function, you can create descendants in the same way as
any other type of object so the whole thing becomes a lot more transparent.

Unfortunately there is no reverse equivalent for creating Lingo objects in
JavaScript (that I know of) but a generic factory class within the openLingo
framework would solve the problem.

- Robert




Wed Mar 10, 2004 1:49 pm

robert_tweed
Offline Offline
Send Email Send Email

Forward
Message #621 of 643 |
Expand Messages Author Sort by Date

Hi everyone, I have been trying out the new javascript functionality and although I expect I am not the only one, there is precious little ...
benstjohnston
Offline Send Email
Mar 9, 2004
7:35 pm

If you look at the big picture, you will find (feel) that the JavaScript in MX 2004 has a version 1 feel. I would wait to DMX 2005 prior to considering...
David Turk
mediasense_oz
Offline Send Email
Mar 9, 2004
10:17 pm

You are probably right - its just a shame that parent/child lingo is only at version 0.9 alpha! At least lingo works with the debugger though - trying to step...
Ben St Johnston
benstjohnston
Offline Send Email
Mar 10, 2004
8:15 am

... From: "David Turk" <mediasense@...> ... JFTR, I think that openLingo should progress as previously forseen, but we should make sure the...
Robert Tweed
robert_tweed
Offline Send Email
Mar 10, 2004
12:14 pm

That might not always work. If you are providing a library of "classes" which people can extend, then you should provide them as javascript and lingo, as you...
Ben St Johnston
benstjohnston
Offline Send Email
Mar 10, 2004
1:10 pm

... From: "Ben St Johnston" <ben@...> ... But that's not what we are doing. We are providing an object-oriented toolset, which people can...
Robert Tweed
robert_tweed
Offline Send Email
Mar 10, 2004
1:49 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help