Dynamic GotoExpression?

Apr 4, 2009 at 1:32 PM
Edited Apr 4, 2009 at 1:44 PM
The language I'm trying to implement using the DLR supports 'dynamic' goto statements, where the target is an expression that is evaluated at runtime. Is there any way to mimic this behaviour with the DLR? All I've seen is a GotoExpression supporting only LabelTarget objects which are defined at compile time. For now I will probably generate a bunch of if-clauses for each available label target.

Thanks in advance for any answers!
Apr 4, 2009 at 2:01 PM
The candidate LabelTargets still need to be defined at compile-time, right (or else how would it know where to go - by line number (which are just implied labels at each line))?  So you'd need a GotoExpression for each possible candidate LabelTarget, with case/switch-ish logic to determine to which to goto....?

Sorry if not helpful.


On Sat, Apr 4, 2009 at 8:33 AM, NLFreeman <notifications@codeplex.com> wrote:

From: NLFreeman

The language I'm trying to implement using the DLR supports 'dynamic' goto statements, where the target is an expression that is evaluated at runtime. Is there any way to mimic this behaviour with the DLR? All I've seen is a GotoExpression supporting only LabelTarget objects which are defined at compile time. Thanks in advance for any answers!

Read the full discussion online.

To add a post to this discussion, reply to this email (dlr@discussions.codeplex.com)

To start a new discussion for this project, email dlr@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Apr 4, 2009 at 2:09 PM
Thanks for your reply! Sorry if my post was unclear. The labeltargets are defined at compile time, but I need to have a way to determine the correct target at runtime. The only way I see now is to create conditional GotoExpressions for each candidate.
Apr 4, 2009 at 2:26 PM
It sounds like you should combine a SwitchExpression with GotoExpressions.