-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
acceptedThis proposal is planned.This proposal is planned.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
Description
Proposal:
return @tailCall(foo, a, b, c);
// roughly equivalent to:
return foo(a, b, c);
The purpose of @tailCall()
is to ensure that a tail call happens. If it cannot, the @tailCall()
produces a compile error.
Here are some cases where a tail call is impossible:
- if the
@tailCall()
expression is not the operand of areturn
operator. e.g.return @tailCall(foo) - 1
. - if there are
defer
statements that would run after the@tailCall()
. e.g.{defer bar(); return @tailCall(foo);}
. - if there is an implicit cast to convert the return value of the called function into the return value of the calling function. e.g.
foo
returnsu8
and the caller returns?u8
.
See also #157.
bbarker, yvt, Sobeston, pixelherodev, marler8997 and 20 moreTerkwoodTerkwood, enpassant and ALizarazoTellezTerkwood
Metadata
Metadata
Assignees
Labels
acceptedThis proposal is planned.This proposal is planned.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.This issue suggests modifications. If it also has the "accepted" label then it is planned.
Type
Projects
Status
To do