Plan 9 from Bell Labs’s /n/sources/patch/applied/acid.unary-plus-list-fix/readme

Copyright © 2009 Alcatel-Lucent.
Distributed under the Lucent Public License version 1.02.
Download the Plan 9 distribution.


Unary + appends zero to lists.

Example:

  acid: +{}
  {0x00000000}

  acid: +{1}
  {0x00000001, 0x00000000}

  acid: defn x() { return {1} ; }
  acid: +x()
  {0x00000001, 0x00000000}

Cause:

  The parser converts '+x' to 'x+0'.  Such is reasonable for
  numeric arguments and has no effect on strings.  Unfortunately
  for lists, it results in a zero being appended.

This patch:

  The parser converts '+x' to 'x+ZN' and oadd() handles the ZN
  rhs when the expression is evaluated.

Patched:

  acid: +{}

  acid: +{1}
  {0x00000001}

  acid: defn x() { return {1} ; }
  acid: +x()
  {0x00000001}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2009 Alcatel-Lucent. All Rights Reserved.
Comments to webmaster@plan9.bell-labs.com.