dgkf / dgkf/R

Implicit casting of vector types on assignment

Open
#54 0 comments 1 reaction 0 assignees View on GitHub
meta-question theme-internals type-design
Dominant language
Rust
Stars
145
Forks
5
PR merge metrics
No merged PRs in 30d

Description

One thing I did not anticipate was the implicit casting of R's internal types upon assignment. For example, this is R's behavior:

```r
x <- c(1, 2, 3, 4, 5)
is.numeric(x)
# TRUE

x[[3]] <- "3"
x
# [1] "1" "2" "3" "4" "5"
```

The current design does not handle such cases and would require a small rework of where mutability is handled. I've got a few different ideas for how things would have to change, but before investing any time in figuring that out, I want to decide whether it's even desirable.

Personally, this feels like more of a footgun than a terribly useful feature. For now I think I'll leave it as.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.