[Bro-Dev] .'s vs. /'s (Re: script loading changes)

Gilbert Clark gc355804 at ohio.edu
Wed Jul 13 17:28:12 PDT 2011



On 7/13/2011 5:20 PM, Jonathan Siwek wrote:
>> ? What's so cool about using '.'s instead of '/'s that it's worth
>> conflicting with the user's file-system mental model?

I'm honestly not too sure how the new scripting stuff works, exactly, so 
forgive my ignorance.  I'm also not a language design guy.

That being said, I disagree that the file-system mental model should be 
applied to a scripting language that uses packages / modules.  The idea 
is that a package is meant to abstract away certain path details that 
are inherent to things like #include; instead of worrying about files, 
you worry about code constructs.

For example, bro.http.headers may not exist as a file on its own; 
instead, bro.http.headers may exist in "./bro/http/extensions.bro"  As 
such, I see a huge difference between @load a/bro/module and @load 
a.bro.module: one loads a file, and the other loads a construct.  As it 
happens, if code is written well, there's a lot of overlap there. . . 
but there's still a big conceptual difference.

I think I'd tentatively argue that, if '.' and '/' are completely 
interchangeable (and *must* remain that way), bro scripts haven't yet 
gotten to the point where they should worry about using '.' to load 
stuff.  If anything, I think folks trying to learn bro script with 
python / java / etc. experience could find the syntax deceptive: "I 
don't think that . means what you think it means."

Just my $0.02, though.

--Gilbert



More information about the bro-dev mailing list