On Fri, Jun 15, 2018 at 7:40 PM Vern Paxson wrote:
> (1) Add bitwise operators on "count" variables for &, | and ~.
Yeah, looks like everyone was in favor of those.
> (2) Deprecate element-wise arithmetic operations on vectors, such
> as "v * 3" meaning "multiply each element of v by 3".
> (3) Implement "v += e" to mean "append the element e to the vector v".
Do we want to do this now, or should we potentially wait a release-cycle
with it (to prevent the situation where v + e and v+= e means something
different).
Looking at the emails I am generally not 100% sure if we reached
1.5 months ago we haggled over adding these and came close to converging,
and then I dropped the ball on trying to ice the deal :-(. (Well, I also
needed some time to lick my wounds, since I didn't get my way much on
syntax preferences! :-P)
Here's where I believe we wound up:
(1) Add bitwise
On 4/30/18 9:54 AM, Robin Sommer wrote:
> One additional piece of context here: That vector(...) syntax could
> then be used more broadly in the sense of creating a different
> semantic context for the operations inside. That kind of opens up a
> whole new set of of type-specific operator
On Mon, Apr 30, 2018 at 07:10 -0700, you wrote:
> Okay, I can live with this as long as '|' and '-' support add-to-set and
> remove-from-set. But I think those have to work, given we'll enable them
> for operations on two sets.
Well, my vote then remains not adding new set operators for
On 4/30/18 9:10 AM, Vern Paxson wrote:
> The question then was what would be the new "v op e" syntax.
> The best we could come up with (which we both found not-too-awful) is
> "vector(v op e)". Wrapped in "vector(...)", the operation becomes the
> current semantics (apply "op e" separately to
On 30 Apr 2018, at 11:13, Robin Sommer wrote:
> On Mon, Apr 30, 2018 at 07:10 -0700, you wrote:
>
>> Okay, I can live with this as long as '|' and '-' support add-to-set and
>> remove-from-set. But I think those have to work, given we'll enable them
>> for operations on two sets.
>
> Well, my
On Mon, Apr 30, 2018 at 07:10 -0700, you wrote:
> "vector(v op e)". Wrapped in "vector(...)", the operation becomes the
> current semantics (apply "op e" separately to each element of v).
One additional piece of context here: That vector(...) syntax could
then be used more broadly in the
> I think I actually would prefer just keeping add/delete, at least for
> sets, and not introduce the plus-syntax.
Okay, I can live with this as long as '|' and '-' support add-to-set and
remove-from-set. But I think those have to work, given we'll enable them
for operations on two sets.
> It especially feels weird to me if v + e and
> v += e are operations that perform something completely different.
Yeah, I hear you. OTOH, I *really* would like a succinct way to say "add
this to the end of this vector", it's such a common idiom.
Robin and I discussed this a bit. Our ultimate
On Thu, Apr 26, 2018 at 09:29:24AM -0700, Vern Paxson wrote:
> > Just one more thing still: I'm actually feeling pretty strongly
> > against having multiple different operators for the same operation
> > (set union, set addition/removal).
>
> I'm fine with removing "add" and "delete" for sets!
On Thu, Apr 26, 2018 at 01:43:53PM -0700, Vern Paxson wrote:
> > A nice thing about "add" and "delete" for sets is that you can infer the
> > I do also notice that you had "s + e" in the proposal and not "v + e".
> > Isn't that weird by the same logic or is it just an accidental omission?
>
>
On 4/26/18 3:43 PM, Vern Paxson wrote:
>> E.g. say you come back to some code after a few months and see "foo +=
>> 1". Not obvious what 'foo' is anymore.
>
> I don't think it's reasonable to have the bar be "can you tell what's going
> on in isolation". It should include consideration of
> A nice thing about "add" and "delete" for sets is that you can infer the
> data type that you're operating on just looking at the local code/line.
Only sort of. For delete, you don't know whether it's a table or a set,
and for neither do you know what type of table/set if you can't
On 4/26/18 11:29 AM, Vern Paxson wrote:
>> Just one more thing still: I'm actually feeling pretty strongly
>> against having multiple different operators for the same operation
>> (set union, set addition/removal).
I'm maybe convincing myself that it's at least not that useful or
there's
> Just one more thing still: I'm actually feeling pretty strongly
> against having multiple different operators for the same operation
> (set union, set addition/removal).
I'm fine with removing "add" and "delete" for sets! (But seems we gotta
keep them for a good while for backward
On Wed, Apr 25, 2018 at 22:19 -0700, you wrote:
> Now there's no problem, since the lexer only recognizes ""
> as a unit, with no whitespace allowed.
Good idea, sounds right. And in case it did turn out to be
problematic, we could still go the way of adding all as keywords
later.
> How does
On 4/26/18 12:19 AM, Vern Paxson wrote:
> Hmmm thinking about it, we can get away with '&' with minimal keyword
> conflict because there's such an easy (and natural-to-presume) fix -
> namely, rather than "x" you use "x & attrkeyword". Now
> there's no problem, since the lexer only recognizes
Hmmm thinking about it, we can get away with '&' with minimal keyword
conflict because there's such an easy (and natural-to-presume) fix -
namely, rather than "x" you use "x & attrkeyword". Now
there's no problem, since the lexer only recognizes ""
as a unit, with no whitespace allowed.
Given
> On Wed, Apr 25, 2018 at 10:40 -0700, you wrote:
>
> > s1 + s2 Set union (for sets of the same type, of course)
> > s1 || s2Set union
>
> (What's the difference between the two? Or do you mean either one or
> the other?)
No difference. It just seems to me that we need
On Wed, Apr 25, 2018 at 10:40 -0700, you wrote:
> s1 + s2 Set union (for sets of the same type, of course)
> s1 || s2Set union
(What's the difference between the two? Or do you mean either one or
the other?)
Like Justin, I was also thinking "|" and "&" might be
> On Apr 25, 2018, at 1:40 PM, Vern Paxson wrote:
>
> I'm working on some scripts that use sets and vectors, sometimes together,
> and am finding it clunky that Bro doesn't offer much in the way of operators
> for this. To that end, I'm thinking of implementing some along the
> That's very similar to what python does, except they use & and | instead of
> && and ||.
> I think they do that because 'set or' is closer to 'bitwise or' than 'logical
> or'
Yeah, I thought of that, but Bro currently doesn't have any '&' or '|'
operators, which makes me reluctant to add them
I'm working on some scripts that use sets and vectors, sometimes together,
and am finding it clunky that Bro doesn't offer much in the way of operators
for this. To that end, I'm thinking of implementing some along the following
lines, where values starting with 's' are sets, 'v' are vectors, and
24 matches
Mail list logo