Skip to content

Commit

Permalink
Remove gratuitous parentheses in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornbm committed Jan 22, 2025
1 parent 3ce4e3f commit 2addcaf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions doc/manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ As an example, consider the same `sum_list` function from above written without
local function iter(arr: {any}, prev: integer): (any, any)
local i = prev + 1
local x = arr[i]
if x == (nil as any) then
if x == nil as any then
return nil, nil
end

Expand Down Expand Up @@ -260,8 +260,8 @@ Pallene also allows you to downcast from `any` to other types.
This is checked at run-time, and may result in a run-time type error.

```lua
local v = (17 as any)
local s = (v as string) -- run-time error: v is not a string
local v = 17 as any
local s = v as string -- run-time error: v is not a string
```

The `any` type allows for a limited form of dynamic typing.
Expand All @@ -280,7 +280,7 @@ The reason for this is that, for performance, Pallene must know at compile-time

```lua
local function f(x: any, y: any): integer
return (x as integer) + (y as integer)
return x as integer + y as integer
end
```

Expand Down Expand Up @@ -405,7 +405,7 @@ For expressions the colon is already used for method calls, so Pallene uses the

```lua
function foo(x : any) : integer
local y: integer = (x as integer)
local y: integer = x as integer
return y + y
end
```
Expand Down

0 comments on commit 2addcaf

Please sign in to comment.