From 5d2c6e89aa3e7b1623d1603af3e4591c785a6396 Mon Sep 17 00:00:00 2001 From: hanez Date: Fri, 26 Sep 2025 07:42:40 +0200 Subject: [PATCH] Some cosmetic fixes... --- examples/classes_demo.fun | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/examples/classes_demo.fun b/examples/classes_demo.fun index eff722c..ebde725 100644 --- a/examples/classes_demo.fun +++ b/examples/classes_demo.fun @@ -1,16 +1,27 @@ #!/usr/bin/env fun -// Classes demo: fields, methods (with explicit 'this'), and usage. -// -// Notes: -// - Define a class with `class Name` -// - Fields are initialized with simple assignments inside the class body. -// - Methods are written as `fun method(this, ...) { ... }` with 'this' required as the first parameter. -// - Instantiation: p = Name() -// - Method calls: load the method function from the instance into a variable, then call it with the instance as the first argument. -// Example: -// move_fn = p["move"] -// move_fn(p, dx, dy) +/* + * This file is part of the Fun programming language. + * https://hanez.org/project/fun/ + * + * Copyright 2025 Johannes Findeisen + * Licensed under the terms of the ISC license. + * https://opensource.org/license/isc-license-txt + */ + +/* + * Classes demo: fields, methods (with explicit 'this'), and usage. + * + * Notes: + * - Define a class with `class Name` + * - Fields are initialized with simple assignments inside the class body. + * - Methods are written as `fun method(this, ...) { ... }` with 'this' required as the first parameter. + * - Instantiation: p = Name() + * - Method calls: load the method function from the instance into a variable, then call it with the instance as the first argument. + * Example: + * move_fn = p["move"] + * move_fn(p, dx, dy) + */ class Point x = 0