Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [xtend] Type Parameter for Create Function?
[xtend] Type Parameter for Create Function? [message #908867] Thu, 06 September 2012 06:24 Go to next message
Jeeeyul Lee is currently offline Jeeeyul LeeFriend
Messages: 117
Registered: July 2009
Location: Seoul
Senior Member

We can write a function which have parmeterized return type like this:
def <T> getSingleTone(Class<T> type){
	return type.createSingleTone() as T
}


But we can't write a create function like this:
def <T> create type.createInstance as T createSingleTone(Class<T> type){
}

I couldn't figure out why there is such restriction on create function.
Re: [xtend] Type Parameter for Create Function? [message #908912 is a reply to message #908867] Thu, 06 September 2012 08:07 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3107
Registered: July 2009
Senior Member
Am 06.09.12 08:24, schrieb Jeeeyul Lee:
> We can write a function which have parmeterized return type like this:
>
> def <T> getSingleTone(Class<T> type){
> return type.createSingleTone() as T
> }
>
>
> But we can't write a create function like this:
>
> def <T> create type.createInstance as T createSingleTone(Class<T> type){
> }
>
> I couldn't figure out why there is such restriction on create function.

Please file a bug. Thanks.

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Previous Topic:How to refer to two rules at the same time
Next Topic:deleted
Goto Forum:
  


Current Time: Fri Feb 21 13:22:05 GMT 2020

Powered by FUDForum. Page generated in 0.01775 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top