On Sun, 2007-08-19 at 13:13 +0300, Rhythmic Fistman wrote:

> p.s. I typedefef the schannel[event_type] thing, but that doesn't seem
> to create the associated constructor (mk_mynewname()), I can use the
> new name but I still have to remember the original type, saying
> var blah = mk_schannel[event_type]();... Is there some other name I
> can do or do I just have to remember or define a new ctor along with
> the typedef?

In this code:

        typedef ammo_chan = schannel[ammo_evt];
        var chan = mk_schannel[ammo_evt] ();
        //var chan = mk_ammo_chan();    // error

the problem is simply that mk_schannel is a function.

When you use a typename as a function like:

        int("1")

Felix searches for

        _ctor_int: string -> ??

This is purely a syntactic hack. You have to define that function:

        fun _ctor_int:string -> string = "$1";

and as you can see the return type doesn't even have to
be an int .. :)

To be a bit more precise the compiler first looks for a function
overload set named 'int'. If it comes back with a single entry,
which is the name of a type or typedef, then it looks for
a function overload set named _ctor_int. If a function
overload set if found it proceeds with overloading, otherwise
you have an error.

SO .. we could have (should have?) defined:

        fun _ctor_schannel[t]: 1 -> schannel[t] = ...

instead of mk_schannel .. however mk_schannel was defined
before the _ctor_typename thing was implemented.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to