[CMake] functions as first class objects

Michael Wild themiwi at gmail.com
Thu Nov 19 05:02:02 EST 2009


On 19. Nov, 2009, at 3:07 , David Manura wrote:

> On Wed, Nov 18, 2009 at 4:58 PM, Alexander Neundorf wrote:
>> On Wednesday 18 November 2009, David Manura wrote:
>>> That would be better than nothing, though it does have a  
>>> limitation in
>>> that you cannot wrap a function more than once.
>> Not sure. Have you tried ?
>
> function(test)
>  message("1")
> endfunction(test)
> test()
>
> function(test)
>  message("2")
>  _test()
> endfunction(test)
> test()  # ok
>
> function(test)
>  message("3")
>  _test()
> endfunction(test)
> test()  # infinite loop
>
> Michael's suggestion would help too, though it might be called a hack.
> The expressiveness of the language could be improved if we could
> allow symbols in the function namespace to be copied or renamed:
>
>  set(&test3 &test)  # bind function symbol "test3" to value of
> function symbol "test"
>  function(test)
>    message("3")
>    test3()
>  endfunction(test)
>

Not sure I'd like that... Instead of being more expressive, I think  
this would be very confusing.

Michael



More information about the CMake mailing list