Re: alleviate the load of the GC

  • From: Coda Highland <chighland@xxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Wed, 2 Sep 2015 09:44:35 -0700

On Wed, Sep 2, 2015 at 9:40 AM, Javier Guerra Giraldez
<javier@xxxxxxxxxxx> wrote:

On Wed, Sep 2, 2015 at 11:29 AM, Coda Highland <chighland@xxxxxxxxx> wrote:
excuse me for being dense, but not knowing what's in vogue in C++, i
don't see the connection between object reuse (that i do a lot in
SnabbSwitch) and operator overloading (which i don't use)

Syntactic sugar. Being able to overload = means that you can replace
the normal "leave the current value for the GC to collect, leaving all
other references alone" behavior with "replace the value in the
current object, also modifying all other references."


ah, ok. that's why the proposal included the lhs value as a
parameter, so it's easy to replace assignment with mutation.

i guess i'm in the camp of those that feel that C++ lost much of its
appeal when it became socially acceptable to make innocent-looking
lines of code to have _any_ result and side effect.

not a path that I'd like to see Lua(JIT or not) go

I'm not in that camp (I feel that it should be mostly obvious from the
types involved what kind of behavior to expect; AFAIK it isn't
socially acceptable to still be surprising when you account for the
types), but I dislike the notion of mixing memory management paradigms
with the same syntax. In C++ at least overloading operator= is
expected to have the same user-facing semantics as the default
behavior, but this suggestion doesn't preserve that.

/s/ Adam

Other related posts: