[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Q] Class definition



Hi!

Is there a good reason why class definitions are not handled as source
code?

It is not possible to put comments there and not possible to change the
layout of things. This is not an idle question as I intend to try out
some ideas that needs type information to be stored with the instance
variables.

The following for example will be parsed and useful with normal ST-80
syntax, at the same time it can be read as having types associated with
the variables. I will present a version of this later this year as an alternative
to the present Slang.

Object subclass: #X
	instanceVariableNames:
		#(":int" i j
		  ":char" c)
	classVariableNames: ''
	poolDictionaries: ''
	category: ''

The compiler (or whoever) changes it to

Object subclass: #X
	instanceVariableNames: 'i j c '
	classVariableNames: ''
	poolDictionaries: ''
	category: ''

Perhaps a new field could be added to ClassDescription for the source code?
That would also make it easier to document the variables, write a short
comment when it is introduced.

Adding a field to all classes and metaclasses, is that very difficult?

/Mats