[YAFR] new magic type Like<T>

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[YAFR] new magic type Like<T>

back2dos
Hi,

I would like to propose the type Like<T>, where T is a class/interface or maybe even anonymous type.
Like<T> is defined to be the anononymous type, that matches T exactly.

As a plus, it would also be nice, if Like<T> wouldn't introduce dependancy on T.
So writing Like<Foo> doesn't necessarily imply Foo will be compiled into the output.

This would be really great for easily decoupling things.

greetz
back2dos
  

GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!   
Jetzt freischalten unter http://movieflat.web.de

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [YAFR] new magic type Like<T>

edA-qa mort-ora-y
Juraj Kirchheim wrote:
> As a plus, it would also be nice, if Like<T> wouldn't introduce
> dependancy on T.
> So writing Like<Foo> doesn't necessarily imply Foo will be compiled into
> the output.
> This would be really great for easily decoupling things.

I have an idea of what this would be used for, but I can't say I've ever
encountered the need for this. Would you be able to provide a short
example of where/how you need it?


--
edA-qa mort-ora-y
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

BigTPoker uses haXe and DHLIB
        http://BigTPoker.com/?source=haxe-list

The dis-Emi-A haXe Library
        http://wiki.disemia.com/HaXe
       
A full set of tools, classes, and support facilities aimed at
simplifying and expediting game creation in Flash 9.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.


--
haXe - an open source web programming language
http://haxe.org

signature.asc (260 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [YAFR] new magic type Like<T>

Cauê W.
Hey Juraj!! How are you?

It would be very great to have it, really... It's more like a compile-time feature, more than a run-time, right?

Maybe with the macros we could be able to create a macro that would do that... e.g.

Class Person
{
public var age:Int;
public var name:String;
}

var something:Like<Person> -->> Would be compiled into var Something:{age:Int, name:String}

Another very useful feature would be the EcmaScript's wrap :

var aName = {name:"AName"};

var something:Wrap<Person> = aName; //ok

type(something) // {name:String, age:Int}
trace(something.age) //null. 

2010/2/19 edA-qa mort-ora-y <[hidden email]>
Juraj Kirchheim wrote:
> As a plus, it would also be nice, if Like<T> wouldn't introduce
> dependancy on T.
> So writing Like<Foo> doesn't necessarily imply Foo will be compiled into
> the output.
> This would be really great for easily decoupling things.

I have an idea of what this would be used for, but I can't say I've ever
encountered the need for this. Would you be able to provide a short
example of where/how you need it?


--
edA-qa mort-ora-y
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

BigTPoker uses haXe and DHLIB
       http://BigTPoker.com/?source=haxe-list

The dis-Emi-A haXe Library
       http://wiki.disemia.com/HaXe

A full set of tools, classes, and support facilities aimed at
simplifying and expediting game creation in Flash 9.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [YAFR] new magic type Like<T>

N David Brown
So this is a request for the ability to perform structural comparison of objects, Juraj? If so, I think this is an excellent idea :)

Dave


On 19 February 2010 16:57, Cauê Waneck <[hidden email]> wrote:
Hey Juraj!! How are you?

It would be very great to have it, really... It's more like a compile-time feature, more than a run-time, right?

Maybe with the macros we could be able to create a macro that would do that... e.g.

Class Person
{
public var age:Int;
public var name:String;
}

var something:Like<Person> -->> Would be compiled into var Something:{age:Int, name:String}

Another very useful feature would be the EcmaScript's wrap :

var aName = {name:"AName"};

var something:Wrap<Person> = aName; //ok

type(something) // {name:String, age:Int}
trace(something.age) //null. 

2010/2/19 edA-qa mort-ora-y <[hidden email]>
Juraj Kirchheim wrote:
> As a plus, it would also be nice, if Like<T> wouldn't introduce
> dependancy on T.
> So writing Like<Foo> doesn't necessarily imply Foo will be compiled into
> the output.
> This would be really great for easily decoupling things.

I have an idea of what this would be used for, but I can't say I've ever
encountered the need for this. Would you be able to provide a short
example of where/how you need it?


--
edA-qa mort-ora-y
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

BigTPoker uses haXe and DHLIB
       http://BigTPoker.com/?source=haxe-list

The dis-Emi-A haXe Library
       http://wiki.disemia.com/HaXe

A full set of tools, classes, and support facilities aimed at
simplifying and expediting game creation in Flash 9.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: [YAFR] new magic type Like<T>

jlm@justinfront.net
So for instance could it be used to convert Quaternions between a 3D engine and Flash one and even somehow specify simple mappings.. like negate q.x and q.y with some cool typeDef converter?  Or is it less powerful?

 
On 19 Feb 2010, at 17:14, N David Brown wrote:

So this is a request for the ability to perform structural comparison of objects, Juraj? If so, I think this is an excellent idea :)

Dave


On 19 February 2010 16:57, Cauê Waneck <[hidden email]> wrote:
Hey Juraj!! How are you?

It would be very great to have it, really... It's more like a compile-time feature, more than a run-time, right?

Maybe with the macros we could be able to create a macro that would do that... e.g.

Class Person
{
public var age:Int;
public var name:String;
}

var something:Like<Person> -->> Would be compiled into var Something:{age:Int, name:String}

Another very useful feature would be the EcmaScript's wrap :

var aName = {name:"AName"};

var something:Wrap<Person> = aName; //ok

type(something) // {name:String, age:Int}
trace(something.age) //null. 

2010/2/19 edA-qa mort-ora-y <[hidden email]>
Juraj Kirchheim wrote:
> As a plus, it would also be nice, if Like<T> wouldn't introduce
> dependancy on T.
> So writing Like<Foo> doesn't necessarily imply Foo will be compiled into
> the output.
> This would be really great for easily decoupling things.

I have an idea of what this would be used for, but I can't say I've ever
encountered the need for this. Would you be able to provide a short
example of where/how you need it?


--
edA-qa mort-ora-y
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

BigTPoker uses haXe and DHLIB
       http://BigTPoker.com/?source=haxe-list

The dis-Emi-A haXe Library
       http://wiki.disemia.com/HaXe

A full set of tools, classes, and support facilities aimed at
simplifying and expediting game creation in Flash 9.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.


--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org

--
haXe - an open source web programming language
http://haxe.org


--
haXe - an open source web programming language
http://haxe.org