Tim Jansen's blog


2004/07/04
Eek's Property Syntax
This old entry in Cedric Beust's (recommended) blog describes the differences of the property syntax in Java, C# and Ruby. So let's do it for Eek. There is one thing to say though, Eek does not make any difference between properties and fields. Everything is the same, and called properties. Read-Write attributes Eek knows two variants here. Either you can implement two accessor methods, or you write it like a Java field. In the first case the object does not have any memory associated with it, so you may want to have a private property to store the value. In the second solution, the object will have memory for the property, and accessors for reading and writing are implicitly created. You can still override them later without losing binary compatibility, but you don't have to write them as long as you don't need them. So here's the accessor method version:
public:
        String firstName.get()
                // some code

        firstName.set(String value)
                // some code
And this is the field syntax version:
public:
        String firstName
Read-Only Attributes Read-only properties can only exist as accessor methods, so there is no short notation. A true read-only field-like property would not make any sense in Eek. And I don't know a good syntax to define a field-like property with different access permissions for reading and writing.. So read-only properties can eiter be created by defining a 'get' method without 'set' method, or by definint the accessor methods with different access permissions:
public:
        String firstName.get()
                // some code
private:
        firstName.set(String value)
                // some code


 

This blog is my dumping ground for thoughts and ideas about Eek. Someday Eek will be a programming language and system, somewhat comparable to Java in scope. It is my attempt to bring sanity to the world of computing.
At least I hope so. Right now it is far from being finished and I can't guarantee that it ever will be. I am still working on the specification, but I won't release anything before I got my first prototype running. The world does not need more vapourware and unusable beta-software. All publicly available information about Eek is contained in this blog. You can find the latest summary here.
This page is powered by Blogger. Isn't yours? Creative Commons License
This work is licensed under a Creative Commons License.