A "general" tag

Xan xancorreu at gmail.com
Sat Apr 14 12:17:51 PDT 2012


Hi,

I try to translate a script I wrote in Fantom [www.fantom.org]. 
In my script, I have a type "Tag" defined as a triple of:
- String (the name of the tag),
- Type (the type of the tag: could be Str, Date, Int, etc.)
- Obj (the value of the tag; Fantom has Objects of Top-Class 
hierachy).

(normally the tag has Type = Obj.Type, but you can manually set).

For example,
you could have:
(name, Str#, "John")

or

(date, Date#, 2011-09-02)


(# is the Fantom way for specifying type: Str# is the sys::Str 
type)


Is there any way for emulating this? My main trouble is how to 
define Type and Object in D.

Thanks in advance,
Xan.

PS: Please, be patient, I'm a newbee.


More information about the Digitalmars-d-learn mailing list