Static and Constant
Author |
Message |
Flikerator
|
Posted: Mon Sep 10, 2007 10:14 pm Post subject: Static and Constant |
|
|
Is there any way to make static variables/procedures for classes in Turing?
If I create a constant variable in a class, and then proceed to make 10 such classes, are there 10 such copies of the constant, or is there only one, thus making it static?
I was looking for a way to create an internal (as in, in the class itself) way to source all the classes of that type that have been created (ie, just a an array of pointers). There are a lot of ways around it, but I'm merely curious as I can't find anything in the help files so I don't think there is a way. Let me know.
Edit: Is there anyway to give special permission? For instance, allow certain modules access to things that other modules can't? I doubt it but it would be handy. |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Cervantes

|
Posted: Tue Sep 11, 2007 12:01 am Post subject: RE:Static and Constant |
|
|
I'm trying hard to remember, and unfortunately I think there's no such thing as static (or class) variables for classes in Turing. As for the module permission thing, you can import certain things into your module, but I don't think that's what you're going for here. I think you're going to have to make that array of objects one level higher in the scope. Tough, eh? |
|
|
|
|
 |
Axlle
|
Posted: Tue Sep 11, 2007 12:09 pm Post subject: Re: Static and Constant |
|
|
With all my experience in turing i think i would do it the simpliest way by leaving the constant in the class unless u want multiple different classes to access it. In that case you could have the classes inherit the constant or import it.
In terms of it being static of not the only people that could answer that would be the creators themselves since its never mentioned in the language itself. My guess would be that its not static because you cant find the location by calling "addr (constName)" when the constant is in a class.
I wouldnt worry about it being created 10 times because turing programs have much larger problems to deal with first. |
|
|
|
|
 |
Cervantes

|
Posted: Tue Sep 11, 2007 9:24 pm Post subject: RE:Static and Constant |
|
|
You have to worry if it's being created 10 times. That's a major logical flaw. Even if you aren't concerned with the memory usage, creating a monster like that has gotta be on your conscious. |
|
|
|
|
 |
|
|