Show Changes Show Changes
Print Print
Recent Changes Recent Changes
Subscriptions Subscriptions
Lost and Found Lost and Found
Find References Find References
Rename Rename
Administration Page Administration Page
Search

History

10/27/2005 9:28:51 PM
BobHy-24.16.75.106
10/11/2004 9:13:08 PM
WardCunningham-24.20.52.130
10/11/2004 9:12:24 PM
WardCunningham-24.20.52.130
10/11/2004 7:20:02 PM
WardCunningham-24.20.52.130
10/11/2004 7:17:51 PM
WardCunningham-24.20.52.130
List all versions List all versions

RSS feed for the FlexWiki namespace

Wiki Talk Type
.
Summary
Every WikiTalk object is of a particular type. That type governs what the object can do.

Overview

This server's WikiTalk has 49 different types built in. These include simple types like String and Number, fancy types like DateTime and TimeSpan, and wiki specific types like Topic and TopicChange. Each server installation can add to the list of types, but is not possible to add new types from WikiTalk. See WikiTalkTypeHierarchy.

Each type defines a set of properties and methods collectivly called members. See WikiTalkMembers.

It is possible to ask an object what type it is using the Type property. For example:

 DateTime.Now.Type

will answer back the type of the Now DateTime object (obviously a DateTime). For another example:

 "hello world".Length.Type

will answer back the type of the length of the string "hello world". The length is 11 and the type of 11 is Integer.

What good is a type, anyway?

Types are typically used to perform Reflection operations (see WikiTalkReflection). For example, once you have the DateTime type, you can ask it questions -- e.g., what properties and methods to you have. In fact that is exactly how the list above is generated. Specifically, a Type has a property called Members which answers a collection of WikiTalkMember objects, each of which define a property or method of the associated type.

Getting your hands on a Type

There are two way to get to a type. The first is by asking an object for its type:

 DateTime.Now.Type
 100.Type
 topic.Type

These will all answer back an appropriate Type object.

All of the WikiTalk types also are simply accessible by name in WikiTalk:

 DateTime.Now

In the above expression, DateTime is the DateTime type.

The other useful thing about Types

As you can see in the above example, Types have not only general things you can ask them that apply to all types (e.g., what are the properties that instances of you have?). Many Types also have specific properties or methods that are only applicable to that type. Now is an example of such a property; it only makes sense for DateTime.

MetaTypes

If every object has a type, what happens when you ask a Type for its Type?

Well, it turns out you get another kind of object called a MetaType. Each Type has a corresponding MetaType. This MetaType object can answer back information about the Type (as opposed to the Type which generally answers back information about its instances).

This can be pretty confusing, so I'll give an example:

If I ask a DateTime for its type, I'll get the Type DataTime.

 topic.LastModified.Type

topic.LastModified answers back the time when the current topic was last modified. The type of object here is a DateTime.

If I ask that type for its Members:

 topic.LastModified.Type.Members.Collect 
   { e | ["        *", e.Signature, Newline] }

I will get a list of properties and methods that make sense for a DateTime:

So, when I say DateTime.Now, what is Now a property of? It's clearly not a property of DateTime (see the above list ). Instead, it is part of the DateType MetaType (designated DateTimeType). if I ask this object (DateTimeType) for its members, I'll get something very different:

 topic.LastModified.Type.Type.Members.Collect 
   { e | ["        *", e.Signature, Newline]}

specifically:

With

Not logged in. Log in

Welcome to the home of FlexWiki, a collaboration tool, based on WikiWiki, implemented using Microsoft .NET technologies

This is FlexWiki, an open source wiki engine.

This site supports the new NoFollow anti-spam initiative.
Change Style

Recent Topics