Monday, March 12, 2012

Reference variables with identical names but different scopes

Hi,
I have a script task that can "see" 2 variables with identical names. The only difference is that they are scoped differently.

As far as I know my script task will use the most locally scoped variable by default. Is there any way to make it use the other one?

-JamieHi it seems as tho I'm going to get much reply so I've submitted this at betaplace: 708844227

-Jamie|||

Give people a chance, you only posted a few hours ago! Saying that from all we have learnt about the “precedence” behaviour of variables and scope, I certainly don’t think it can be done. Did you suggest a fully qualified syntax to access higher variables? I’d quite like that, but not a big deal for me (yet).

|||

DarrenSQLIS wrote:

Give people a chance, you only posted a few hours ago! Saying that from all we have learnt about the “precedence” behaviour of variables and scope, I certainly don’t think it can be done. Did you suggest a fully qualified syntax to access higher variables? I’d quite like that, but not a big deal for me (yet).

Yeah I know, sorry, but when I said I didn't think i was going to get a reply I meant because I'm convinced this can't be done so I wanted to get the bug in ASAP. Also Doug contacted me offline and as-near-as-makes-no-difference confirmed my suspicions.

A fully qualified syntax is what I had in mind but I didn't suggest it - better let the dev team come up with their own ideas I reckon. Besides, in my scenario that wouldn't work because it could be akin to hardcoding the scope and I want a generic event handler that works for all containers, but basically ignores the "most local" scope. Does that make sense?
A fully qualified syntax is a good idea though.

The more and more I look at this though the more I'm becoming convinced that this system variable that is scoped to the task in the event handler is something new in June CTP. I'm pretty sure that before then:

-there was only ever one occurence of System::ContainerStartTime
-it contained the start time of the container raising the event
-and it was scoped to the event handler

That is EXACTLY the same as System::SourceName, System::SourceDescription, System::SourceID, etc...

-Jamie

No comments:

Post a Comment