[Bug tapsets/13721] local variable name collision
dsmith at redhat dot com
sourceware-bugzilla@sourceware.org
Thu Feb 23 18:29:00 GMT 2012
http://sourceware.org/bugzilla/show_bug.cgi?id=13721
--- Comment #5 from David Smith <dsmith at redhat dot com> 2012-02-23 18:28:03 UTC ---
(In reply to comment #4)
> (In reply to comment #3)
> > I'd probably prefer adding the "local" keyword as opposed to reducing the scope
> > of what "global" means. The latter seems more surprising.
>
> It seems to me that any tapset that relied on a global from the user script
> would be prone to bugs. i.e. if the user forgot to define the global, then the
> tapset would implicitly use a local instead, with quite different behavior. So
> my intention is that restricting global in this way, that user globals are only
> available to the user's script, actually has a DWIM flavor -- it's unlikely
> that a tapset should ever mean to reference a user's global. But if the
> consensus is that this is too weird or surprising, so be it.
>
> A "local" keyword will do the trick, but I imagine it will make authoring more
> tedious. We end up more verbose, and any time the "local" is forgotten, that
> becomes a latent bug in the tapset waiting for a name clash.
Hmm, I see your point about forgetting a local and being right back where we
are now.
(One advantage to 'local' that I just thought of is that a user could use it in
his own script where reducing the scope of what "global" means doesn't help a
user in his own script.)
But, on balance perhaps reducing "global"s scope make more sense.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Systemtap
mailing list