[Bro-Dev] set and vector operators
robin at icir.org
Mon Apr 30 08:34:20 PDT 2018
On Mon, Apr 30, 2018 at 10:10 -0500, you wrote:
> That still seems odd to me. If "v += e" means "append", then I might
> expect "v + e" to do the same, except producing a new value w/ original
> vector not modified.
Yeah, I agree with that actually. Getting rid of the current "v + e"
semantics (which nobody knows/uses anyways) means we can turn both '+'
und '+=' into add-element-to-vector operations. Question is if we want
to do that right away, or wait for a version for deprecating/flagging
current usage of "v + e" (although I doubt there's any!)
On Mon, Apr 30, 2018 at 10:21 -0500, you wrote:
> Isn't the existing "v + e" an alternative that one could say is "better" ?
Only if we don't want "+" to mean "append element to vector". If we
switch '+' to meaning that, then there's nothing good left for the
operation "add e to all vector elements". And the "append" operation
indeed seems more common in Bro than the element-wise operation, so
I'd prefer switching.
> Just to put it out there again: I wouldn't mind something like "append(v, e)"
I don't really like the free function style very much, what I could
see is using methods: "v.append(e)". I actually like that style quite
a bit. But as I said to Vern last week, it'd be a bit odd to introduce
that pattern to Bro now, we don't use that style anywhere else. May be
just too late for starting that.
Robin Sommer * ICSI/LBNL * robin at icir.org * www.icir.org/robin
More information about the bro-dev