I agree with Johanna that whatever is done, it would be best if it were 
consistent, and not vary with the type of the captured variable.

IIRC, in the ‘70s, it was up to FORTRAN compiler writers whether arguments 
passed to procedures and functions were passed by value or by reference, and 
some individual compilers varied their behavior with the argument type. This 
led to all kinds of bugs and headaches.

Personally, I like the approach used for C++ lambdas, where captured variables 
are passed by value unless they’re explicitly marked to be passed by reference. 
But I don’t know how much work something like that would be.

> On Dec 9, 2020, at 1:53 PM, Johanna Amann <joha...@icsi.berkeley.edu> wrote:
> 
> My proposal is to change the semantics to instead be shallow-copying, which 
> means that atomic values are copied, but aggregate values (tables, records, 
> and vectors) are shared. With this change, the above code would print 3. 
> However, this code would still print 5:
> 
> I for one don’t really like this; in my opinion, atomic values and aggregate 
> types should behave the same. Everything else feels at least unintuitive to 
> me.
> 
> I also agree with Christian that, given the choice between a deep copy and 
> the current functionality, I like the current functionality more.
> 
> Though I would still prefer deep copies to having different behavior for 
> aggregate/nonaggregate types.
> 
> Johanna
> 
> _______________________________________________
> zeek-dev mailing list -- zeek-dev@lists.zeek.org
> To unsubscribe send an email to zeek-dev-le...@lists.zeek.org

_______________________________________________
zeek-dev mailing list -- zeek-dev@lists.zeek.org
To unsubscribe send an email to zeek-dev-le...@lists.zeek.org

Reply via email to