Skip to content

Commit

Permalink
update cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
mertcandav committed Mar 27, 2024
1 parent 2423258 commit 9bd7ef9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
6 changes: 5 additions & 1 deletion src/memory/mutability.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ Cloning supported types and copy methods:

- `jule:derive Clone`\
Clones struct if derives `Clone`.\
Returns new independent mutable struct.
Returns new independent mutable struct.

- Anonymous Functions
Returns copy of value.
Does not creates new anonymous function, juts copies reference to existing function.

### Cloning Cycles
Clone cycles are a kind of illegal cycle. In cases where you risk an endless cloning cycle at runtime, the compiler will give you an illegal cycle error. Cloning cycles usually occur in nested types, in which it will try to clone itself forever, which somehow attaches to itself.
Expand Down
7 changes: 0 additions & 7 deletions src/std/builtin.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,6 @@ fn clone(expr: T): T
```
Returns mutable deep-clone of expression.

Allowed types:
- `[]T`
- `[...]T`
- `[K:V]`
- `&T`
- `*T:`
- `jule:derive Clone`
::: tip
[See more cloning information.](/memory/immutability#cloning)
:::
3 changes: 1 addition & 2 deletions src/std/jule-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,7 @@ Compiler log messages with formatting.
- `NoFileInEntryPackage`
- `NoMemberInEnum`
- `TypeIsNotDerives`
- `CloneNonLvalue`
- `CloneImmutStruct`
- `TypeNotSupportsClone`
- `InternalTypeNotSupportsClone`
- `TypeNotCompatibleForDerive`
- `DeriveIllegalCycleRefersItself`
Expand Down

0 comments on commit 9bd7ef9

Please sign in to comment.