Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL]println() in declarative expressions?
[ATL]println() in declarative expressions? [message #52417] Fri, 13 July 2007 14:51 Go to next message
Eclipse UserFriend
Originally posted by: matt.mcgill.gmail.com

I'll state right up front that what I'm trying to do is really ugly, and
probably not a good idea. That being said, I still wish I could do it =)

I was hoping to get some debug output during the evaluation of a
recursive helper. The helper looks like this:

helper context UML!Namespace def:
firstStateMachine : UML!StateMachine =
let debug3 : String =
'firstStateMachine ('+self.name+')'.println() in
if self.oclIsTypeOf(UML!StateMachine) then
let debug1 : String =
'firstStateMachine: found statemachine'.println() in
self
else
let debug2 : String = 'firstStateMachine: iterating'.println() in
self.ownedElement->collect(c |
if c.oclIsKindOf(UML!Namespace) then
Sequence {c.firstStateMachine}
else
Sequence {}
endif
)->flatten()->first()
endif;


I was hoping that println() evaluated to the string it was printing,
which would cause the above to work. However, when I tried to execute
the transformation containing this helper, I received the first line of
output ('firstStateMachine (foo)') and immediately thereafter an
EmptyStackException, so I presume that println() does *not* evaluate to
anything, and is only meant for imperative statements. Nuts.

So here's my question: is there any technical hurdle that would prevent
println() from evaluating to a String (and thereby enabling its use in
declarative expressions)? Because it would make debugging a lot easier =)

Why am I not using the debugger, you ask? Because I'm executing my
transformation programmatically, in a JUnit test, that's why! TDD and
all that...

Thanks, and sorry for suggesting such an atrocity,
-Matt McGill
Re: [ATL]println() in declarative expressions? [message #52429 is a reply to message #52417] Fri, 13 July 2007 14:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tristan.faure.c-s.fr

I don't really understand what you code must do, but the function to use
is toString() instead of println() no ???
Re: [ATL]println() in declarative expressions? [message #52453 is a reply to message #52429] Fri, 13 July 2007 15:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tristan.faure.c-s.fr

actually i misunderstood ^^ and i can't help you sorry :/
Re: [ATL]println() in declarative expressions? [message #52477 is a reply to message #52417] Fri, 13 July 2007 15:04 Go to previous messageGo to next message
Guillaume Hillairet is currently offline Guillaume HillairetFriend
Messages: 97
Registered: July 2009
Member
Hi,

The function you're searching for is .debug(String)
Re: [ATL]println() in declarative expressions? [message #52503 is a reply to message #52477] Fri, 13 July 2007 16:06 Go to previous message
Eclipse UserFriend
Originally posted by: matt.mcgill.gmail.com

Guilaume Hillairet wrote:
> Hi,
>
> The function you're searching for is .debug(String)
>

Thanks, that's exactly what I meant =) But I didn't expect to find it on
OclAny, so I only looked at the string datatype.

-Matt
Previous Topic:[ATL]Problem with toSequence operator
Next Topic:[ATL] Problems with XMLInjector class
Goto Forum:
  


Current Time: Thu Apr 25 19:22:09 GMT 2024

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

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

Back to the top