Only Syntax

Journal of my investigation into the development of a new programming language

Thursday, January 13, 2005



One of the nice features of C# is properties; from the outside they behave like instance variables but internally they act more like functions. Each property has a getter and/or setter (named, reasonably enough, "get" and "set").

C#'s setters use the keyword "value" for the value being passed in. If I put properties into my language, I think I may instead use the name of the thing, as in this example, from the range class:

. . get: return low + length - 1
. . set: length = high - low + 1

Of course this is inconsistent - the meaning of high everywhere else in the program will be to invoke the getter or setter - but it seems very clear. Intention-revealing.

Comments: Post a Comment

<< Home


03/30/2003 - 04/06/2003   04/06/2003 - 04/13/2003   10/12/2003 - 10/19/2003   01/09/2005 - 01/16/2005   01/16/2005 - 01/23/2005  

This page is powered by Blogger. Isn't yours?