[Bro-Dev] attributes & named types

Vern Paxson vern at corelight.com
Mon Sep 10 15:08:05 PDT 2018

> My understanding was just that TypeType's currently are *not* used
> when creating type aliases.


> # Passing the type name/alias as a value.
> # The local variable/argument 'x' becomes of type
> # "TypeType".  It's not of type "count".
> foo(mytype);

(Note that here any attributes are lost, since there's currently no
 place for TypeType's to hold them.)

> 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).

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.


More information about the bro-dev mailing list