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...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

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
update to openLingo and singleton scripts   Message List  
Reply | Forward Message #635 of 643 |
Re: [openLingo] update to openLingo and singleton scripts

----- Original Message -----
From: "James Newton" <james.newton@...>
>
> > - Do not comment indvidual lines or chunks of code unless absolutely
> > necessary. In such cases, explain *why* the code is written the way it
is,
> > not *what* the code does, unless it really is not obvious what the code
is
> > doing by looking at it.
>
> There are times when I would want to comment the *what* of an individual
> line of code. For example, an Undo script may need to do several things,
> such as altering a data structure, updating an interface in a MIAW and
> updating an interface on the Stage. Each of these operations would need a
> comment to distinguish it from the others, even if the operation itself
only
> required a single line of code.

Bear in mind that these are only *guidelines* not hard-and-fast rules (which
the naming conventions pretty much are). They are just a guide to writing
good code. There are of course, exceptions. Rather than try to list all the
exceptions it's better to just leave it up to the good judegement of the
programmer to know when something makes sense. In a more complete writeup
I'd probably stress the flexibility of the above a bit more, but the good
thing about putting it that way is that it makes people _think_ about their
comments a bit more, and avoid over-commenting.

> > The openLingo naming convention is:
> >
> > - Names are always first-letter caps with the first word (or prefix)
being
> > all lowercase. Only exception is private globals...
> > - Private globals begin with a double underscore and words are all
> > lowercase, separated by underscores, e.g., __global_controller
>
> Excuse my ignorance, but what is a "private global"?

Well there is no such thing as a private anything in Lingo. However, the
concept of a private global is similar to a static variable in C, where the
variable should be local to a specific package or collection of packages,
but it simply isn't possible to create such a thing in Lingo.

In fact, it is possible to create static variables but they are very slow to
access, so not ideal if you need to access them frequently. Also, this still
wouldn't make them any more private than a global variable, so there isn't
much point.

Basically with the openLingo naming convention, if something has an
underscore at the start of it's name you need to think twice before directly
accessing it - the chances are it doesn't belong to you, and there will
always be an alternative interface provided.

The openLingo wrapper script contains one "private" global called
__ol_singleton. No-one should ever access this variable. It is used in the
wrapper scripts, but those scripts are the only ones that should ever touch
that variable. If anyone else wants to do anything with that variable, it
should be done via the interface provided.

- Robert




Fri Jun 18, 2004 1:48 pm

microaeon
Offline Offline
Send Email Send Email

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

Hi! I had some time to tweak the approved openLingo scripts tonight between the children screams. First I changed the default prefix in openLingo from "ol" to...
Christoffer Enedahl
Enedahl
Offline Send Email
Jun 17, 2004
5:12 am

... Hi everyone, I notice that the approved scripts contain structures like: on getCount me _errorSymbol = void --Reset any previous error if ListP(...
James Newton
openspark
Offline Send Email
Jun 17, 2004
12:56 pm

... <unlurk> makes sense to me, that's my style, too. </unlurk>...
Stefan Ladstaetter
stefan_matic
Offline Send Email
Jun 17, 2004
1:44 pm

Consider the notion seconded. On another note, is there a good place on openLingo where people can put examples or proof-of-concept pieces created using the...
Mathew Ray
mrayinteractive
Offline Send Email
Jun 17, 2004
2:24 pm

... From: "James Newton" <james.newton@...> ... Not really, these points were never brought up before, so it was never a criteria for whether...
Robert Tweed
microaeon
Offline Send Email
Jun 17, 2004
2:12 pm

... Hi Robert, That makes sense. ... There are times when I would want to comment the *what* of an individual line of code. For example, an Undo script may...
James Newton
openspark
Offline Send Email
Jun 18, 2004
1:28 pm

... From: "Mathew Ray" <mathew@...> ... At the moment, you can upload whatever you like into the files area. To keep things organised, what we do is: -...
Robert Tweed
microaeon
Offline Send Email
Jun 17, 2004
2:46 pm

... From: "James Newton" <james.newton@...> ... is, ... is ... only ... Bear in mind that these are only *guidelines* not hard-and-fast rules (which ...
Robert Tweed
microaeon
Offline Send Email
Jun 18, 2004
1:50 pm

Hi everyone, I've just uploaded three scripts to: <http://groups.yahoo.com/group/openLingo/files/openSpark/> Two of these (GroupBroker and SpriteGroup) allow...
James Newton
openspark
Offline Send Email
Jun 24, 2004
11:51 am
Advanced

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