[Bro-Dev] attributes & named types
jsiwek at corelight.com
Mon Sep 10 15:34:21 PDT 2018
On Mon, Sep 10, 2018 at 5:08 PM Vern Paxson <vern at corelight.com> wrote:
> > At least that's how I think it's currently working, so are you going
> > start using TypeType as a means of type aliasing in addition to adding
> > attributes to them?
> Not quite. Rather, the type of "mytype" would be a TypeType, which would
> have attributes. The TypeType instance however would not know that it
> belongs to "mytype" (just as is currently the case).
Ok, think I got it now (and agree it seems like a possible way forward
> We could continue to support a call like "foo(mytype)" above by hoisting
> the base type (what the TypeType points to) when evaluating the expression
> "mytype", just as currently the identifier gets turned into a TypeType at
> that point. That said, just what is the use for calls like "foo(mytype)"
> anyway? Seems a bit peculiar, but maybe I'm missing something.
The actual usage I know is from Log::create_stream(), like this one:
Log::create_stream(DPD::LOG, [$columns=Info, $path="dpd"]);
There, the Info is a type that's being stored into the $columns record
field of type 'any'. It's not exactly the same as "passed as function
argument" example I gave, but same idea.
I think TypeType was added particularly for this logging framework usage.
More information about the bro-dev