Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
shiinamiyuki committed Nov 22, 2024
1 parent ddc2805 commit baf2020
Show file tree
Hide file tree
Showing 19 changed files with 8,332 additions and 2,009 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,5 @@ cython_debug/
# Added by cargo

/target
Cargo.lock
Cargo.lock
scripts/cpp_lib.hpp
208 changes: 4 additions & 204 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ version = "0.1.0"
edition = "2021"

[dependencies]
pyo3 = { version = "0.22", optional = true }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
glam = { version = "0.29.2", optional = true }


[build-dependencies]

[features]
jit = ["pyo3"]
default = ["glam"]
glam = ["dep:glam"]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import luisa_lang as lc
## Basic Syntax
### Difference from Python
There are some notable differences between luisa_lang and Python:
- Variables have value semantics by default. Use `inout` to indicate that an argument that is passed by reference.
- Variables have value semantics by default. Use `byref` to indicate that an argument that is passed by reference.
- Generic functions and structs are implemented via monomorphization (a.k.a instantiation) at compile time rather than via type erasure.
- Overloading subscript operator and attribute access is different from Python. Only `__getitem__` and `__getattr__` are needed, which returns a local reference.

Expand Down Expand Up @@ -55,9 +55,9 @@ a.x = 2.0
lc.print(f'{a.x} {b.x}') # prints 2.0 1.0
```

You can use `inout` to indicate that a variable is passed as a *local reference*. Assigning to an `inout` variable will update the original variable.
You can use `byref` to indicate that a variable is passed as a *local reference*. Assigning to an `byref` variable will update the original variable.
```python
@luisa.func(a=inout, b=inout)
@luisa.func(a=byref, b=byref)
def swap(a: int, b: int):
a, b = b, a

Expand Down
Loading

0 comments on commit baf2020

Please sign in to comment.