<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">I am not convince that the proposed syntax is a good idea because it introduce a new syntax just to solve one action on a list.
<div><br /></div>
<div>What about introducing a syntax similar to the version comparison:</div>
<div>
<ul>
<li>LENGTH_EQUAL</li>
<li>LENGTH_GREATER</li>
<li>LENGTH_LOWER</li>
<li>etc…</li>
</ul>
<div>To use it:</div>
</div>
<div>if (my_list LENGTH_EQUAL 1)</div>
<div> # do my stuff</div>
<div>endif()</div>
<div><br /></div>
<div>Or introduce a more general syntax for list management as part of an expression:</div>
<div>$LIST{<op>,<list>[,<arg>,…]}</div>
<div><br /></div>
<div>Where <op>, <list> and <arg> use same semantic as list command.</div>
<div>To use it:</div>
<div>of ($LIST{LENGTH,my_list} EQUAL 1)</div>
<div> # do my stuff</div>
<div>endif()</div>
<div><br /></div>
<div>The advantage of this syntax is extensibility: More <op> can be added and more commands can be introduced (for example $STRING{…}).</div>
<div><br /></div>
</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">Le 22 janv. 2019 à 16:37 +0100, Brad King via cmake-developers <cmake-developers@cmake.org>, a écrit :<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">On 1/22/19 10:28 AM, Torsten@Robitzki.de wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;">With `$CACHE{VAR}` and `$ENV{VAR}` we already have the syntax for calling a „function“.<br /></blockquote>
<br />
No, there is no obvious way to pass arguments, handle nested quoting, etc.<br />
The language was not designed for that. That is a big can of worms I'd rather<br />
not open just to solve the list length problem which is already only 2 lines.<br />
<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;">Once we have this, it would be possible to define $LIST_LENGTH in the CMake language<br /></blockquote>
<br />
Not as efficiently as a dedicated syntax for the only language construct<br />
we have that resembles a data structure.<br />
<br />
-Brad<br />
--<br />
<br />
Powered by www.kitware.com<br />
<br />
Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ<br />
<br />
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br />
<br />
CMake Support: http://cmake.org/cmake/help/support.html<br />
CMake Consulting: http://cmake.org/cmake/help/consulting.html<br />
CMake Training Courses: http://cmake.org/cmake/help/training.html<br />
<br />
Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html<br />
<br />
Follow this link to subscribe/unsubscribe:<br />
https://cmake.org/mailman/listinfo/cmake-developers<br /></blockquote>
<div></div>
</div>
</body>
</html>