3 ms·
(I'm the author of the blog post) Indeed it's exactly the same idea (and I think `value_ptr` is actually a better name than `box`). I've googled before writin
by maattdd 3y ago
(I'm the author of the blog post)
Indeed it's exactly the same idea (and I think `value_ptr` is actually a better name than `box`).
I've googled before writing the blog post and haven't found literature about this (but I was mostly googling stuff around "box" or "deep shared ptr").
Thank you for the link! Kinda glad it's more widespread than what I though actually, it means we can think about making an official proposal.
- andrewmcwatters 3y ago"Boxing" as a term is a fairly well known concept. Unboxed values, etc.
- lelanthran 3y agoI haven't seen it used in any mainstream language.
- tonyarkles 3y agoWhile slightly different, the first place I remember hearing the term was Java. It was solving a slightly different problem: primitive types were not objects. You’d have an int, but many data structures require the things you stored to be subclasses of Object. There were a bunch of objects with names like Integer that you could use instead, but in the early days there was a non-trivial performance hit associated with the “boxed” values.
- Quekid5 3y agoJava isn't mainstream? Granted, Java has 'references' instead of pointers, but they're close enough that the concept of boxing is basically the same.
- zaphirplane 3y agoAnd rust has the terminology https://doc.rust-lang.org/std/boxed/struct.Box.html https://doc.rust-lang.org/std/boxed/struct.Box.html
- lelanthran 3y agoI was referring to the term "Boxing", not the concept. No mainstream language that I am aware of uses the term "Box", while they almost all have something similar in concept, if not identical.
- virtue3 3y agoI think Java, Haskell and C# are the main languages where you have both boxed and unboxed values (C++ if you start doing smart pointer stuff I suppose, tho "String" could be considered a very fancy boxed char*). Python, Ruby, and JavaScript all have exclusively boxed values. "Everything is an object". I'm not sure what languages you use but that pretty dramatically covers most of the mainstream (top 10 at least).
- Quekid5 3y agoThe term Boxing is used in Java. (JVM languages really.)
- pjmlp 3y agoBoxing is common term in Java and .NET worlds.
- spott 3y agoWhat do you consider a mainstream language? Rust uses it in their standard library[0]. Haskell uses it[1]. Lisp seems to have originated the concept in the form of box diagrams[2]. F# uses it [3]. I think it might be a functional programming thing. [0] https://doc.rust-lang.org/std/boxed/struct.Box.html https://doc.rust-lang.org/std/boxed/struct.Box.html [1] https://downloads.haskell.org/~ghc/6.12.1/docs/html/users_guide/primitives.html https://downloads.haskell.org/~ghc/6.12.1/docs/html/users_gu... [2] https://www.gnu.org/software/emacs/manual/html_node/elisp/Box-Diagrams.html https://www.gnu.org/software/emacs/manual/html_node/elisp/Bo... [3] https://fsharpforfunandprofit.com/posts/cli-types/ https://fsharpforfunandprofit.com/posts/cli-types/
- nly 3y agoThere was a proposal for such a thing in 2014 A Proposal for the World's Dumbest Smart Pointer, v4 - Open Standards https://open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4282.pdf https://open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4282.p...