Re: E patches for review: ELoader, FileGetter

Thomas Leonard <[email protected]>
Newsgroups gmane.comp.lang.e.general
Message-ID <[email protected]>
On 24 May 2010 17:57, Kevin Reid <kpreid-M/[email protected]> wrote:
> On May 24, 2010, at 11:10, Thomas Leonard wrote:
>> On Mon, 2010-05-24 at 09:51 -0400, Kevin Reid wrote:
[...]
>>>I just think that the *default* module-loading protocol
>>> should permit modules to instantiate shared DeepFrozen objects.
>>
>> I can think of cases where that would be useful (e.g. interfaces and
>> guards). I assume such changes would also apply to the regular
>> ImportLoader (i.e. they're not specific to the modules system)?
>
> We want a module system that replaces ImportLoader.
>
>> What about these though?
>>
>> # A.emaker
>> interface foo {}
>> def x := 0
>> [x, foo]      # (DeepFrozen)
>>
>> # B.emaker
>> interface bar {}
>> var x := 0
>> [x, bar]      # (not DeepFrozen)
>>
>> Will I get a single instance of "foo" each time I import A, but a
>> different (!=) instance of "bar"?
>
> As it currently stands, if it were not for the fact that foo and bar
> are not actually DeepFrozen, the answer is yes.

[ actually, not since r753 ]

> I think the right answer here is that all elements of a module
> (<someloader:B>) should be evaluated at-most-once and required to be
> DeepFrozen, unless explicitly specified to act otherwise (either in
> metadata or metacode).

OK, if we're changing it everywhere so it's consistent then I think
I'm happy with that. It would be more like the way I expected E to
work when I first started using it. It would simplify some of my code,
too.

What are the security implications? e.g. say I have a file like this:

# securePair.emaker
interface FooGuard guards FooAuditor { }
[FooGuard,FooAuditor]

Before, another emaker could import this and use FooAuditor. If anyone
else imported it, they just got a new copy and no harm done. Now, that
same code would be insecure.

I don't think I've seen any code like this, but maybe there are more
subtle cases?


-- 
Dr Thomas Leonard		ROX desktop / Zero Install
GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1
GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.