[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AS_VAR_APPEND [was: [PATCH] Support a stack of LINENO values for AS_MESS
From: |
Eric Blake |
Subject: |
AS_VAR_APPEND [was: [PATCH] Support a stack of LINENO values for AS_MESSAGE.] |
Date: |
Thu, 16 Oct 2008 06:34:56 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Paolo Bonzini on 10/16/2008 1:41 AM:
>> or maybe even write AS_APPEND([var],[text]), which expands to a shell
>> function
>> that uses += on bash and traditional appends elsewhere?
>
> That could be added (but AS_VAR_APPEND please, for consistency).
In addition to appending, we also need to choose the right name for
basename and dirname.
Right now, we have AS_SET_CATFILE, which requires var to be a shell name,
then we have the AS_VAR_* namespace, which is polymorphic to act on both
shell names (literals) and shell indirections.
So, I guess the naming depends on whether we want to support indirections.
If we name it AS_VAR_APPEND (likewise for AS_VAR_BASENAME), then we use
AS_LITERAL_IF to provide appropriate eval's to dereference indirection
when needed; if we name it AS_SET_APPEND, then the user must pass a
literal name and cannot benefit from indirection.
I think this discussion has convinced me - AS_VAR_APPEND sounds like the
right name, but it means we have to do more work to make it work on both
literals and indirection.
>> And the quadratic nature of this algorithm is only apparent on
>> heavily nested code; how deep do you anticipate a typical nesting of the
>> as_lineno_stack to reach?
>
> Anyway I don't expect more than 5.
Good - all my worries about quadratic behavior are rendered irrelevant, as
optimizing this won't really help performance.
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkj3NPAACgkQ84KuGfSFAYA0PgCfarxaEU9R2/iWPcLO+n256EDe
qAwAn1lByb/MY2OvNRcresNz0fsSqBVs
=drla
-----END PGP SIGNATURE-----