zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: "Zsh-workers" <zsh-workers@sunsite.dk>
Subject: Re: [PATCH][RFC] check for heap memory in zfree()
Date: Sun, 05 Mar 2006 12:43:16 -0800	[thread overview]
Message-ID: <060305124316.ZM25210@torch.brasslantern.com> (raw)
In-Reply-To: <200603051723.k25HNdZI003407@pwslaptop.csr.com>

On Mar 5,  5:23pm, Peter Stephenson wrote:
} Subject: Re: [PATCH][RFC] check for heap memory in zfree()
}
} Bart Schaefer wrote:
} > Maybe someone can remind me why it's up to the parameter set-function
} > to free its argument?  That seems completely inside-out to me.
} 
} For normal parameters this is typically more efficient (I presume; I
} haven't followed it through to make sure) since there's no additional
} copy; it's just assigned to the array variable and the old value
} is freed.

Knowing a bit about how PF thinks, that's probably the right answer.

Any objections to my committing my patch?  With one additional tweak
to call zheapptr() before zarrdup() in the builtin.c hunk.
 
} Later:
} > } OR you guys are now going to say: "Don't you know you're not
} > } supposed to use typeset with dirstack!!"
} >
} > You aren't, but the shell isn't supposed to crash, either.
} 
} Why not?

schaefer[514] typeset -T DIRSTACK dirstack
typeset: dirstack: can't change type of a special parameter

IMO a unique array is a distinct type from an ordinary array.

} If you weren't supposed to do that kind of thing, dirstack wouldn't
} be writeable.  Since it is, this needs to be handled transparently.
} If it quacks like a parameter and waddles like a parameter, a user
} should assume it swims on water like a parameter (er, as it were).

Some of our quacking and waddling parameters are already dog-paddling.
For example, although you can (without getting warnings) set the -LRZ
options on any array, they don't have any effect except to make the
array show up in "typeset -LRZ" output.

} It seems to me that behind both of these is the tension between the
} ability to make a feature look like a parameter and efficiency of
} implementation for normal parameters.

I think you're only half right.  Efficiency isn't the problem when it
comes to having an internal construct like the dirstack linked list
made visible via an array parameter -- the problem is that there's no
way for the other code that manipulates the structure to know that
the parameter exists and has its own value rules.  The way to fix
that is to require that the parameter's rules conform to the internal
structure it represents, not the other way around.


  reply	other threads:[~2006-03-05 20:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060302175252.GA31734@let.rug.nl>
     [not found] ` <200603041104.48265.arvidjaar@mail.ru>
2006-03-04  8:57   ` Andrey Borzenkov
2006-03-05  9:13     ` Bart Schaefer
2006-03-05 17:23       ` Peter Stephenson
2006-03-05 20:43         ` Bart Schaefer [this message]
2006-03-06 10:32           ` Peter Stephenson
2006-03-06 16:25             ` Bart Schaefer
2006-03-04  9:28   ` [PATCH] Re: dirstack history: loving zsh, crashing zsh Andrey Borzenkov

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=060305124316.ZM25210@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.dk \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).