git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Max Kirillov <max@max630.net>
To: Paul Mackerras <paulus@samba.org>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH v2 2/3] gitk: write only changed configuration variables
Date: Thu, 30 Oct 2014 23:43:57 +0200	[thread overview]
Message-ID: <20141030214357.GA6484@wheezy.local> (raw)
In-Reply-To: <20141030095513.GE16472@iris.ozlabs.ibm.com>

Hi.

On Thu, Oct 30, 2014 at 08:55:13PM +1100, Paul Mackerras wrote:
> It seems to me that we need the trace only for the
> non-array configuration variables; the array case is only
> for the view definitions, and I think we could just set
> the changed flag for a view explicitly in [newviewok].
> That would simplify things quite a bit.

I liked the idea to exploit that tcl can watch array element
uniformly with scalar variables. But I agree that the result
is a bit complicated. I will try to use the explicit flag and
see how it's going to look.

> On Sun, Sep 14, 2014 at 11:35:58PM +0300, Max Kirillov wrote:
> I'm also not convinced we need all the uses of upvar.  Why do we need
> to use upvar to rename viewname, viewfiles etc. to current_viewname,
> etc.?  If you're concerned about what might possibly be in the .gitk
> when you source it, perhaps doing the source inside a namespace would
> be a cleaner approach?

I have tried namespaces originally but failed with them.
Apparently when "set v .." runs in namespace and global v
exists, it modifies the global v rather than creates a new
variabe in a namespace. I don't remember all details now but
I could not find how to make it with namespaces. I should
say I had not known anything about tcl namespaces before
I started doing this but, so maybe I missed something.

-- 
Max

PS: the script which shows the namespace behavior:

> set a 1
> namespace eval ns1 {
>  set a 2
> }
> puts "a=$a"
> puts "ns1::a=$ns1::a"

Output is:
> a=2
> can't read "ns1::a": no such variable
>    while executing
> "puts "ns1::a=$ns1::a""

  reply	other threads:[~2014-10-30 21:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-14 20:35 [PATCH v2 0/3] gitk: save only changed configuration on exit Max Kirillov
2014-09-14 20:35 ` [PATCH v2 1/3] gitk refactor: remove boilerplate for configuration variables Max Kirillov
2014-10-30  9:47   ` Paul Mackerras
2014-09-14 20:35 ` [PATCH v2 2/3] gitk: write only changed " Max Kirillov
2014-10-30  9:55   ` Paul Mackerras
2014-10-30 21:43     ` Max Kirillov [this message]
2014-09-14 20:35 ` [PATCH v2 3/3] gitk: synchronize config write Max Kirillov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141030214357.GA6484@wheezy.local \
    --to=max@max630.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).