From 75e2b639232db93f2a03bdc536b592f7df5b51b5 Mon Sep 17 00:00:00 2001 From: sergeych Date: Sun, 4 Jan 2026 23:06:36 +0100 Subject: [PATCH] fixed fences in the docs --- docs/OOP.md | 10 +++++----- docs/exceptions_handling.md | 2 +- docs/scopes_and_closures.md | 2 +- docs/tutorial.md | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/OOP.md b/docs/OOP.md index 8a8ef12..a07cd98 100644 --- a/docs/OOP.md +++ b/docs/OOP.md @@ -566,7 +566,7 @@ c.increment() // OK You can also apply restricted visibility to custom property setters: -```kotlin +```lyng class Person(private var _age: Int) { var age get() = _age @@ -578,7 +578,7 @@ class Person(private var _age: Int) { A `protected set` allows subclasses to modify a field that is otherwise read-only to the public: -```kotlin +```lyng class Base { var state = "initial" protected set @@ -761,7 +761,7 @@ Just like methods, you can extend existing classes with properties. These can be A read-only extension can be defined by assigning an expression: -```kotlin +```lyng val String.isLong = length > 10 val s = "Hello, world!" @@ -772,7 +772,7 @@ assert(s.isLong) For more complex logic, use `get()` and `set()` blocks: -```kotlin +```lyng class Box(var value: Int) var Box.doubledValue @@ -795,7 +795,7 @@ Extensions in Lyng are **scope-isolated**. This means an extension is only visib You can define different extensions with the same name in different scopes: -```kotlin +```lyng fun scopeA() { val Int.description = "Number: " + toString() assertEquals("Number: 42", 42.description) diff --git a/docs/exceptions_handling.md b/docs/exceptions_handling.md index 00c3a6b..f6a56b2 100644 --- a/docs/exceptions_handling.md +++ b/docs/exceptions_handling.md @@ -136,7 +136,7 @@ Serializable class that conveys information about the exception. Important membe A simple structire that stores single entry in Lyng stack, it is created automatically on exception creation: -```kotlin +```lyng class StackTraceEntry( val sourceName: String, val line: Int, diff --git a/docs/scopes_and_closures.md b/docs/scopes_and_closures.md index 2029114..7e6683f 100644 --- a/docs/scopes_and_closures.md +++ b/docs/scopes_and_closures.md @@ -72,7 +72,7 @@ Tip: If a closure unexpectedly cannot see an outer local, check whether an inter The `cached` function (defined in `lyng.stdlib`) is a classic example of using closures to maintain state. It wraps a builder into a zero-argument function that computes once and remembers the result: -```kotlin +```lyng fun cached(builder) { var calculated = false var value = null diff --git a/docs/tutorial.md b/docs/tutorial.md index 8d9053e..a3de0cf 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -1553,13 +1553,13 @@ It is extremely simple to use: you pass it a block (lambda) that performs the co ### Basic Example -```kotlin +```lyng val expensive = cached { println("Performing expensive calculation...") 2 + 2 } -println(expensive()) // Prints "Performing expensive calculation..." then "4" +println(expensive()) // Prints "Performing expensive calculation...") then "4" println(expensive()) // Prints only "4" (result is cached) ``` @@ -1573,7 +1573,7 @@ println(expensive()) // Prints only "4" (result is cached) This is the most common use case for `cached`. It allows you to define expensive "fields" that are only computed if someone actually uses them: -```kotlin +```lyng class User(val id: Int) { // The details will be fetched only once, on demand val details = cached {