Pages: [1]
  Print  
Author Topic: Static object variables  (Read 1005 times)
Offline (Male) RetroX
Posted on: January 26, 2011, 05:15:26 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
This is something that I think would be particularly useful.  Opinions?  Not sure if they'd use the member ( . ) operator or scope resolution ( :: ) like C++.  Probably could be an option.

For those that are unfamiliar, static variables are variables that are accessed by a class, or object type, rather than a specific instance.
« Last Edit: January 26, 2011, 06:07:28 PM by RetroX » Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Rusky
Reply #1 Posted on: January 27, 2011, 12:00:07 AM

Resident Troll
Joined: Feb 2008
Posts: 960
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
Would be nice. The choice of operator depends on how close EDL is to C++- :: only exists for backward compatibility with C code that takes advantage of struct tags:
Code: (C) [Select]
struct foo { int x; static int y; }
struct foo foo; // this is allowed
Since that's kind of obsolete and even more so in EDL, using (or at least including as an option) . is probably a good idea.
Logged
Offline (Female) IsmAvatar
Reply #2 Posted on: January 27, 2011, 01:04:45 AM

LateralGM Developer
LGM Developer
Location: Pennsylvania/USA
Joined: Apr 2008
Posts: 886

View Profile Email
I'm also in favor of . especially for consistency. It's also the way Java does it.
Logged
Offline (Male) RetroX
Reply #3 Posted on: January 27, 2011, 01:07:29 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
I like the scope resolution because it treats classes like namespaces.  I found how Java did it as being weird. :V
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Rusky
Reply #4 Posted on: January 27, 2011, 02:52:06 PM

Resident Troll
Joined: Feb 2008
Posts: 960
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
Java and C# use . for namespaces, classes and objects. It's more consistent and simpler. The only reason for a different operator is to support struct tags, which are only needed to allow variables named after types, which nobody does anymore even though it's possible. You can treat classes as namespaces without ::.
Logged
Offline (Male) Josh @ Dreamland
Reply #5 Posted on: January 28, 2011, 12:52:43 AM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2925

View Profile Email
As it stands, ENIGMA uses . for all other access. A single dot will represent the correct choice of GM access (integer.variable), instance access (inst.member), or pointer access ((&inst)->member). I was considering having it resolve scopes as well, but it may require a special flag on results from the type resolver or before the call to it, depending on how I have it structured (An actual 'int' keyword should be distinguishable from an int variable).
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Offline (Male) RetroX
Reply #6 Posted on: January 28, 2011, 10:26:25 AM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Well, I suppose that it will be fine.  I still find it weird to have one operator for everything, but as it stands, I think that it will be fine.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Josh @ Dreamland
Reply #7 Posted on: January 28, 2011, 03:17:00 PM

Prince of all Goldfish
Developer
Location: Ohio, United States
Joined: Feb 2008
Posts: 2925

View Profile Email
Frankly, I kind of like it better as ::, too. I'll see about supporting all three ( . -> and :: ) for their C++ purposes.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Pages: [1]
  Print