The following issue has been SUBMITTED. ====================================================================== http://austingroupbugs.net/view.php?id=1072 ====================================================================== Reported By: quinngrier Assigned To: ====================================================================== Project: 1003.1(2013)/Issue7+TC1 Issue ID: 1072 Category: Shell and Utilities Type: Clarification Requested Severity: Comment Priority: normal Status: New Name: Quinn Grier Organization: User Reference: Section: m4 (utility) Page Number: 2899, 2901 Line Number: 95625, 95733 Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2016-08-27 01:18 UTC Last Modified: 2016-08-27 01:18 UTC ====================================================================== Summary: m4 ifelse argument expansion clarification Description: <p>The description of the m4 ifelse macro includes the following sentence: </p><blockquote>If the first two arguments compare as equal strings (after macro expansion of both arguments), the defining text shall be the third argument. </blockquote><p>The parenthetical remark is presumably intended to be a reminder that all arguments are expanded as they are collected, but it can also be interpreted to mean that these two particular arguments are expanded a second time. It is difficult to refute this interpretation because this section provides little explanation of how arguments are expanded and generally uses the word "argument" to refer to an argument that has already been expanded as it was collected. </p><p>To illustrate, consider the following example: </p><blockquote><pre>define(`foo', `baz')dnl<br>define(`bar', `baz')dnl<br>ifelse(foo, bar, `hello')`'dnl<br>ifelse(`foo', `bar', ` world')`'dnl<br>ifelse(``foo'', ``bar'', ` never')</pre></blockquote><p>It is clear that the first comparison is true and the third is false, but what about the second? Should the output of this example be "hello", or should it be "hello world"? The expectation is that it should be "hello", but the parenthetical remark raises the concern that it may be "hello world". The output is indeed "hello" on several implementations: GNU M4 1.4.17, FreeBSD 10.3, and OpenIndiana Hipster 2016.04. </p> Desired Action: <p>On line 95625, add the following sentence to the end of the paragraph to provide some explanation of how arguments are expanded: </p><blockquote>Macro expansion is performed on the arguments as they are collected. </blockquote><p>On line 95733, remove the following parenthetical remark to maintain consistency with the general use of the word "argument" to refer to an argument that has already been expanded as it was collected: </p><blockquote>(after macro expansion of both arguments) </blockquote> ======================================================================
Issue History Date Modified Username Field Change ====================================================================== 2016-08-27 01:18 quinngrier New Issue 2016-08-27 01:18 quinngrier Name => Quinn Grier 2016-08-27 01:18 quinngrier Section => m4 (utility) 2016-08-27 01:18 quinngrier Page Number => 2899, 2901 2016-08-27 01:18 quinngrier Line Number => 95625, 95733 ======================================================================