Hi,

Regarding:
-----------------
> > 2) Have methods which are not attached to specific class instances.
> 
> That's a bit like static methods no ?

I was incomplete. I should have said, "Have *bundled* methods which are
not attached to specific class instances." That is, I want to be able to
have groups of static methods. Static classes are how this is currently
accomplished, but if we can't have private constructors, there's no way
to prevent someone from (pointlessly) instantiating a static class.

Can methods be attached to packages in AS3.0? If so, that might help.
-----------------


Yes, this can be done in AS 3.0.  Note that the Flash IDE requires you
to name your .as file with the same name as the function so that the IDE
can find the definition.

// foo/bar/MyFunction.as
package foo.bar
{
        public function MyFunction()
        {
                trace("MyFunction");
        }
}

// test.fla
import foo.bar.*;

MyFunction();


You can also define functions in the unnamed package. That way, you can
use the function without the import statement as long as that function
is in your classpath:

// HelloWorld.as
package
{
        public function HelloWorld()
        {
                trace("Hello, World!");
        }
}

// test.fla
HelloWorld();

-Nivesh
QE Lead, Flash | Adobe Systems

------------------------------

Message: 5
Date: Wed, 12 Jul 2006 09:16:41 -0700
From: "Mike" <[EMAIL PROTECTED]>
Subject: RE: [Flashcoders] Abstract classes in AS3?
To: "'Flashcoders mailing list'" <flashcoders@chattyfig.figleaf.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;       charset="US-ASCII"

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Nicolas
Cannasse
Sent: Wednesday, July 12, 2006 1:16 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Abstract classes in AS3?
>
> Mike Keesey wrote:
> > I don't really care whether they allow private constructors or not,
as
> > long as they provide some way of accomplishing the same thing.
> > Specifically, I want to be able to:
> > 1) Limit the number of instances of certain classes (singletons,
> > enumerations).
>
> Did you have a look at haXe enums ?
> http://haxe.org/ref#the_power_of_enum

Sure, something like that would be nice. But it's not in AS3.0.

> > 2) Have methods which are not attached to specific class instances.
> 
> That's a bit like static methods no ?

I was incomplete. I should have said, "Have *bundled* methods which are
not attached to specific class instances." That is, I want to be able to
have groups of static methods. Static classes are how this is currently
accomplished, but if we can't have private constructors, there's no way
to prevent someone from (pointlessly) instantiating a static class.

Can methods be attached to packages in AS3.0? If so, that might help.

> > 3) Be able to create classes that cannot be instantiated themselves
but
> > can be superclasses of concrete classes.
>
> Yes, I agree there. Removing the ability to create private
constructors
> seems completely pointless. The rational behind it seems a bit like
"you
> don't need that", which is not a very strong point IMHO.

Exactly!

Replace the removed functionality with some other strategy, but don't
just get rid of it and pretend nothing's wrong.
--
Mike Keesey
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to