[Nix-dev] [PATCH] second revision

Marc Weber marco-oweber at gmx.de
Tue Jul 20 18:18:42 CEST 2010


  Second revision of patch allowing you to use arbitrary strings as attr names.
  The second revision also allows accessing attrs by strings.
  Example:
    attr."the attr name"

  I've spend several hours trying to understand which is the best way to pass a
  string from lexer to the parser. I failed doing so. This solution at least doesn't
  segfault, but boxes the string in a ExprString object which is unnecessary.

  +    if(ExprString* str = dynamic_cast<ExprString*>(x))
  +      $$ = strdup(str->s.c_str());

  So please review this part and think about whether there is a better way.

I tried sending this mail about one week ago.
Somehow it never reached the mailinglist - sorry for the delay.

Marc Weber (1):
  t/allow-arbitrary-strinsg-in-names

 doc/manual/writing-nix-expressions.xml          |    6 ++++-
 src/libexpr/parser.y                            |   26 +++++++++++++++++-----
 tests/lang/eval-okay-attrs-strings-as-names.exp |    1 +
 tests/lang/eval-okay-attrs-strings-as-names.nix |   15 +++++++++++++
 4 files changed, 41 insertions(+), 7 deletions(-)
 create mode 100644 tests/lang/eval-okay-attrs-strings-as-names.exp
 create mode 100644 tests/lang/eval-okay-attrs-strings-as-names.nix




More information about the nix-dev mailing list