From 6c7c2f5a5104acdcd42bfa610f46c1d2c7a283bc Mon Sep 17 00:00:00 2001 From: Magnus Madsen Date: Tue, 31 Mar 2026 13:05:21 +0200 Subject: [PATCH] refactor: delete varargs section from calling-methods.md --- src/calling-methods.md | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/calling-methods.md b/src/calling-methods.md index 50d5689c..69594d65 100644 --- a/src/calling-methods.md +++ b/src/calling-methods.md @@ -94,32 +94,6 @@ def main(): Unit \ IO = println(Math.abs(-123.456f64)) ``` -## Calling Constructors or Methods with VarArgs - -We can call a constructor or method that takes variable arguments using the -special syntax `...{ value1, value2, ...}`. For example: - -```flix -import java.nio.file.Path - -def getMyPhoto(): Path \ IO = - Path.of("Documents", ...{"Images", "me.jpg"}) -``` - -Here we call the `Path.of` Java method which requires a single string and then -a varargs array of strings. - -In the special case where we want to call a constructor or method without any -varargs we have to explicitly pass an empty `Vector[t]`. Moreover, we have to -specify the type of the elements. For example: - -``` -import java.nio.file.Path - -def getDocuments(): Path \ IO = - Path.of("Documents", (Vector.empty(): Vector[String])) -``` - ## When Constructor or Method Resolution Fails In some cases the Flix compiler is unable to determine what Java constructor or