Sunday, January 11, 2015

Mozilla Rust - box()

I started watching an Introduction to Rust video when the presenter got to the box(). According to the rust-lang reference manual:
A box is a reference to a heap allocation holding another value
And when you use the rust stdlib there is a Box class that looks like any "generic" implementation. In rust a box of an int might be Box<int>. And while the JDK manual references auoboxing with a similar description there is no actual box class or function. A box'd instance might look like Integer<int>.

I turned in my java beans a very long time ago and I don't know much about rust but I do know that this is an awkward to design a language. Boxing is probably a good thing for the internals, however, it's existence and promotion to something that requires first-class consideration from the programmer seems less pragmatic.

While the structure is probably there in order to provide some space for the various runtime and compile-time protection mechanisms as a systems language it does not seem to provide value. But then I'm naive to it for now.

And depending on the actual benefit I'm finding myself thinking about erlang and other functional programming languages where this sort of silliness does not exist.

No comments:

Post a Comment

static site generators

Static site generators are pretty cool. Granted they are an oversimplification of the java/json/xml/xslt site manifestation from the olden d...