Opened 11 years ago

Closed 11 years ago

#72 closed enhancement (fixed)

kmk: Add .RETURN and .ARGC to $(evalcall ) and $(evalcall2 ) for creating functions

Reported by: bird Owned by: bird
Priority: major Milestone: 0.1.5
Component: kmk Version: 0.1.4
Keywords: Cc:


To create more complicated functions without also creating an unreadable mess, it's necessary to make $(evalcall[2] ) be able to return a value. This is implemented using a local variable .RETURN, the function body assigns the desired return value to this variable.


define POP
local words := $(words $($1))
local .RETURN := $(word $(words), $($1))
$1 := $(wordlist 1, $(expr $(words) - 1), $($1))

stack-var = a b c d
d-element := $(evalcall POP,stack-var)

In addition, it's very useful to have some way of getting at the argument count without evaluating all the possibilities. For this purposed .ARGC was added. It is also applied to $(call ).

Change History (1)

comment:1 Changed 11 years ago by bird

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.