[haXe] Class parameter
Franco Ponticelli
franco.ponticelli at gmail.com
Thu Sep 13 19:54:50 CEST 2007
A type parameter can have the keyword Const in which case the instance must
be created with a constant value.
Try the following code:
class Main {
public static function main() {
var a = new A<"mystring">();
type(a);
}
}
class A<Const> {
public function new() { }
}
The type of a is Main<Smystring> the S prefix indicates that is a string
value (can be also I or F). To retrieve the value at runtime you have to use
the RTTI API.
On 9/13/07, Ian Liu <ian.liu88 at gmail.com> wrote:
>
> Hi.
>
> Reading the last mails, I've got confused with this:
>
> ... extends Foo<"bar"> ...
>
> What does this string means? How can I access it in my class? I tried this
> with no success:
>
> class A<T> {
> public function new() {
> trace(T);
> }
> }
>
> Thanks!
> Ian L.
>
> --
> haXe - an open source web programming language
> http://haxe.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20070913/caa91e1b/attachment-0001.htm
More information about the Haxe
mailing list