yutannihilation / savvy

A simple R extension interface using Rust
https://yutannihilation.github.io/savvy/guide/
MIT License
70 stars 4 forks source link

Disallow modification of env of a struct or an enum #262

Closed yutannihilation closed 4 months ago

yutannihilation commented 4 months ago

Close #261

library(savvyExamples)

# struct
Person$new_method <- function() NULL
#> Error: Person cannot be modified

p <- Person$new()
p$.ptr <- NULL
#> Error: Person cannot be modified

# enum
FooEnum$A <- NULL
#> Error: FooEnum cannot be modified
FooEnum$C <- "C"
#> Error: FooEnum cannot be modified

a <- FooEnum$A
a$.ptr <- NULL
#> Error: FooEnum cannot be modified

Created on 2024-06-09 with reprex v2.1.0