Re: [cmake-developers] $LIST_LENGTH{} syntax (was: Support for list length expression in if()-command?)

2019-01-22 Thread Robert Maynard via cmake-developers
I like some syntax that looks like $LEN{}.

I would love to keep the $...{ syntax open for future exentsion such
as easy target property set/get ( $[prop_name]{target} ) . This seems
to be okay as $ENV, and $CACHE only work on variables, so therefore
adding $LEN that also only works on variables seems reasonable.

On Tue, Jan 22, 2019 at 7:46 AM Brad King via cmake-developers
 wrote:
>
> On 1/22/19 7:40 AM, Daniel Franke wrote:
> > Whats about a Syntax like
> >
> > ${list::LENGTH}
>
> That would require dispatch after matching `${VAR}` syntax, and
> that lookup is one of the hottest paths according to profiling.
> We already have $ENV{} and $CACHE{} syntax.
>
> -Brad
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more 
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake-developers
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers


Re: [cmake-developers] $LIST_LENGTH{} syntax (was: Support for list length expression in if()-command?)

2019-01-22 Thread Brad King via cmake-developers
On 1/22/19 7:40 AM, Daniel Franke wrote:
> Whats about a Syntax like
> 
> ${list::LENGTH}

That would require dispatch after matching `${VAR}` syntax, and
that lookup is one of the hottest paths according to profiling.
We already have $ENV{} and $CACHE{} syntax.

-Brad
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers


Re: [cmake-developers] $LIST_LENGTH{} syntax (was: Support for list length expression in if()-command?)

2019-01-22 Thread Brad King via cmake-developers
On 1/22/19 7:09 AM, tors...@robitzki.de wrote:
>> Am 22.01.2019 um 12:42 schrieb Brad King:
>> Rather than a special `if` syntax, perhaps we could introduce an
>> explicit `$LIST_LENGTH{mylist}` syntax.  One would need to experiment
>> to see if modifying the variable expansion parser (under CMP0053 NEW
>> behavior only) to support this would have a significant performance
>> impact.
> 
> What would be a good experiment setup?

Using `cmake -P test.cmake` to run a script that does a lot of
variable evaluations without the proposed syntax, and later with it.

> How about adding the ability to add such function? Like:
> 
> procedure(LIST_LENGTH list)
>   list(LENGTH list length)
>   return(${length})
> endprocedure()

We don't have a syntax for invoking functions with return values.
That's a whole other discussion.

-Brad
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake-developers