fixed fences in the docs

This commit is contained in:
Sergey Chernov 2026-01-04 23:06:36 +01:00
parent 5f1e6564d5
commit 75e2b63923
4 changed files with 10 additions and 10 deletions

View File

@ -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)

View File

@ -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,

View File

@ -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

View File

@ -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 {