bcquality/microsoft/knowledge/style/function-call-parentheses-required.md
Jesper Schulz-Wedde b6da405376 Improve partner onboarding and documentation navigation
Lead with a complete plugin quick start and add task-oriented usage, troubleshooting, customization, and contribution guides. Preserve the broader plugin framing, correct conflicting contract guidance, support Agents folder reviews, and align repository validation. Convert existing sample references to clickable links without changing knowledge rules.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-09-09 17:25:29 +02:00

1.7 KiB

bc-version domain keywords technologies countries application-area
all
style
parentheses
function-call
method-call
aa0008
codecop
al
w1
all

Always write parentheses on procedure calls (CodeCop AA0008)

Description

AL allows a parameterless procedure to be called without parentheses — Customer.Init instead of Customer.Init() — and the result is syntactically identical at runtime. CodeCop AA0008 still flags the parenthesis-less form. The reason is twofold: written without parentheses, a procedure call is visually indistinguishable from a property read, which makes BC code harder to scan; and the same identifier may exist as both a property and a procedure on different objects, so the parentheses are the only local signal that this is a call. The rule applies to every parameterless invocation, including Init, Insert, Modify, Delete, DeleteAll, FindFirst, FindSet, Next, Get, CalcFields, and user-defined procedures.

Best Practice

Always write () on a procedure call, even when it takes no arguments: Customer.Init();, TempBuffer.DeleteAll();, if Customer.FindFirst() then …. The same applies inside expressions and as a condition.

See sample: function-call-parentheses-required.good.al.

Anti Pattern

Customer.Init;, TempBuffer.DeleteAll;, if Customer.FindFirst then …. Every one of those is an AA0008 violation. Reviewers should treat a parameterless procedure name appearing without parentheses as a defect, even though the compiler accepts it.

See sample: function-call-parentheses-required.bad.al.