IngramChen 積分 0

變天了!

value type 改名 InlineType , InlineType 不能 null,要多一層 IndirectType才行 (後面加個 ?)

IndirectType 白話講就是 Boxed Type 吧

primitive 和 boxed type:

int -> Integer 

到了 inline 和 indirect 就會寫成這樣

inline class Foo

Foo -> Foo?

所以 inline type 可直接當 primitive 來看,像這種寫法 List<Foo> 是不行的,你得用 indirect type (即Boxed),也就是 List<Foo?>

私以為這個設計高竿,只用一個 symbo ? 直接解決原本 value type 模菱兩可的表示 (看不出到底有沒有 boxing),而這個 ? 可以為了之後的 nullable type 舖路

這是文章的子討論串,你可以回到上層查看所有討論和文章
IngramChen 積分 0

然後這些看起來奇怪的限制,kotlin 應該會幫我們處理掉,直接享受 inline type 帶來的好處,哈!

IngramChen 積分 0

不知道會不會有 string (小寫) 這種 inline type,因為字串在程式裡用太多了,如果不能鑲在 inline type 裡用途就少很多