Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » emulate return functions and objects in xbase???
emulate return functions and objects in xbase??? [message #1053570] Mon, 06 May 2013 10:52 Go to next message
Yoandri Saavedra is currently offline Yoandri Saavedra
Messages: 24
Registered: February 2013
Junior Member

Hi, Xbase is that does not support functions or objects, but if my interpreter recognizes expressions will exist some method using lambda ... imagine this...
function name (param1, param 2){
  print("Hi world!!!");
  return true;
}

var d = name("any", "bye");

print d; 


and the console look at Hi World!!! true

and This is possible with xbase????
Re: emulate return functions and objects in xbase??? [message #1053853 is a reply to message #1053570] Tue, 07 May 2013 17:29 Go to previous messageGo to next message
Yoandri Saavedra is currently offline Yoandri Saavedra
Messages: 24
Registered: February 2013
Junior Member


any ideas?? .. anything??? .. can not??
Re: emulate return functions and objects in xbase??? [message #1053859 is a reply to message #1053853] Tue, 07 May 2013 18:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6126
Registered: July 2009
Senior Member
Hi,

xbase has lamba support. so i dont really get your question
Re: emulate return functions and objects in xbase??? [message #1057928 is a reply to message #1053859] Thu, 09 May 2013 16:19 Go to previous messageGo to next message
Yoandri Saavedra is currently offline Yoandri Saavedra
Messages: 24
Registered: February 2013
Junior Member

yes.. how I can use lamba???...the xtext tutorial is very short...
Re: emulate return functions and objects in xbase??? [message #1057937 is a reply to message #1057928] Thu, 09 May 2013 17:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6126
Registered: July 2009
Senior Member
See the docs:

val func = [ String s | s.length>3 ]
Re: emulate return functions and objects in xbase??? [message #1058071 is a reply to message #1057937] Fri, 10 May 2013 15:21 Go to previous message
Yoandri Saavedra is currently offline Yoandri Saavedra
Messages: 24
Registered: February 2013
Junior Member

Thaks..yes.. but if my rules is
function: 
   'func' name=ValidID '(' arg=OneArg ')'
    '{'
        exp+=XExpresion ';'
       (return Other ';')?
    '}'


How I can create the _evaluateXXXFunction

protect Object evaluatefunction(literal, ctx, indic){
  Object result = ?????function(ctx.branch, body???);
  I no idea...
}
Previous Topic:Missing type info in JvmType model
Next Topic:Calling a custom compiler
Goto Forum:
  


Current Time: Wed Jul 23 22:37:42 EDT 2014

Powered by FUDForum. Page generated in 0.06071 seconds