← Back to team overview

ooc-dev team mailing list archive

Re: New ORC draft - Properties


Hi all,

I just added a basic implementation of the ORC in rock's `properties`
branch. To test, use the `properties/001-dog.ooc` example in `tests`.

For now, supported features include getters and setters, accessing the
actual value inside getters/setters, calling get/set inside
getters/setters and replacing ordinary variable accesses `object
property` and assignments `object property = value` with appropriate
getter/setter calls.

Not working for now (but I'm working on this): automatic assignment
arguments in setters (`set(=age)`), default getters/setters, missing
getters/setters. I think this shouldn't take too long. ;-)

One implementation note: A property named `foo` creates a member `foo`
in the struct, no name mangling is done. This should be okay, shouldn't it?

I noticed one thing in the ORC: We have this automatic assignment
argument feature (`set(=age)`, aka AssArg). However, this would force
the user to use the property name as argument name to avoid
inconsistency with the regular automatic assignment argument, right?

Some code:

Dog: class {
	name: String {
		/* This would not work, right? */
		set(=arg) {
			/* ... */
		/* rather, we'd need */
		set(=name) {
			/* ... */

I think we should keep this behavior. Just wanted to make sure that this
is wanted by everyone =)



Follow ups